Service v1
5 min
Functional Specification
1. Introduction & Overview
- 1.1. Purpose: The CommandIT Agent Service is a lightweight, secure background application installed on managed endpoints. Its primary functions are to:
- Establish and maintain a unique, verifiable identity for each managed device.
- Collect comprehensive hardware, software, OS, network, security, and performance data.
- Monitor endpoint health and status.
- Report collected data and status changes to the central CommandIT platform.
- Receive and execute commands/scripts from the platform.
- Enforce configured policies (Compliance, Security).
- Provide data for troubleshooting, asset management, security posture assessment, and compliance reporting, while preventing device duplication.
- 1.2. Target Platforms:
- Microsoft Windows (Client: 10, 11; Server: 2016, 2019, 2022 and later - 32-bit and 64-bit). Windows on ARM (ARM64) support included, noting potential limitations in deep hardware data availability compared to x86_64 requiring specific testing.
- Apple macOS (Latest 3 major versions - Supporting both Intel and Apple Silicon (ARM64) architectures via Universal Binary, noting collection method differences where applicable).
- Linux (Common server distributions: Ubuntu LTS 18.04+, RHEL/CentOS/Rocky 7+, Debian 10+ - 64-bit).
2. Core Architecture & Concepts
- 2.1. Execution: Runs as a persistent background service (Windows Service, macOS launchd daemon, Linux systemd service) with high privileges (LocalSystem on Windows, root on macOS/Linux) required for deep system inspection and task execution. Built in Go (Universal Binary for macOS).
- 2.2. Communication: Communicates exclusively with the CommandIT Server API over secure HTTPS/TLS channels (TLS 1.2+). All data transmission must be encrypted. Agent validates server certificate; server authenticates agent via its unique identity.
- 2.3. Local Caching: Utilizes a local, persistent data store (e.g., embedded SQLite database) to:
- Cache current configuration and policies received from the server.
- Store the last known state of collected inventory data for delta comparisons.
- Maintain the processing state for event log monitoring (e.g., last record ID/timestamp processed per log source) to prevent duplicates locally.
- Queue data uploads and command results, enabling offline operation and upload upon reconnection.
- Store unique IDs of locally detected events (e.g., FIM, PII, Threats) and their upload status for queueing.
- 2.4. Agent Identity: Each agent instance possesses a unique device_id (UUID) and authenticates using a device_secret. This identity is established during the initial registration process and stored securely locally (DPAPI/Keychain). It is preserved during agent updates and standard repairs but cleared upon uninstallation or when clone detection triggers re-registration.
3. Key Features & Modules
- 3.1.1. Manual Installation UI & Workflow (Client-Site): (Minimal UI functionality)
- If parameters missing, installer may fail or require post-install configuration.
- If GUI implemented later: Requires technician authentication. Workflow: Select Org -> Select Optional Location -> Optional Asset Tag entry -> Optional COA Details (Version, Key) entry -> Triggers Registration Process.
- 3.2. Core Agent Management:
- Check-in & Clone Detection:
- Agent connects (POST /api/v1/agent/{deviceId}/checkin using deviceId/secret) every 60 seconds.
- Payload includes current Hardware Identifiers.
- Backend Validation: Authenticates agent. Retrieves stored HW IDs. Compares current HW IDs with stored IDs (logic needs tolerance/tuning for VMs/WinARM).
- Backend Response (Match): Processes check-in, updates Devices.last_agent_checkin, returns config/commands (including fast mode toggle).
- Backend Response (Mismatch): If significant mismatch detected: Rejects check-in, responds "Hardware Mismatch - Re-register Required", does not update last_agent_checkin. (Admin intervention needed for legitimate HW changes).
- Agent Response to Mismatch: Clears local identity. Restarts full registration process (Section 3.1).
- Self-Update: Fetches assigned AgentUpdatePolicies. Downloads/applies updates securely per policy. Reports status to AgentUpdateStatusLog. (Core service handles update checks based on policy).
- Health Monitoring: Monitors own service status/resources. Reports health (Devices.agent_health_...).
- Configuration Management: Downloads/applies assigned AgentConfigurations and related policies during check-in.
- 3.3. Inventory Collection:
- Schedule: Performs a full inventory scan upon installation and then on a regular schedule (e.g., daily, configurable). Detects changes between full scans (delta) and uploads changes frequently (based on polling cycle, Section 3.4). Supports on-demand full sync request from the server. Requires elevated privileges (Administrator/root) for comprehensive data access.
- Data Points: The agent shall collect and report the following categories of data using the specified OS-native methods where applicable. This data populates corresponding server-side tables or JSONB fields after being cached and synchronized locally (See Section 4.1.2).
- Hardware:
- System Manufacturer (Devices) (Win: WMI: (Get-CimInstance Win32_ComputerSystem).Manufacturer; Mac: ioreg -rd1 -c IOPlatformExpertDevice | grep manufacturer or system_profiler SPHardwareDataType; Lin: sudo dmidecode -s system-manufacturer)
- System Model (Devices) (Win: WMI: (Get-CimInstance Win32_ComputerSystem).Model; Mac: system_profiler SPHardwareDataType | grep 'Model Name'; Lin: sudo dmidecode -s system-product-name)
- System Serial Number (Devices) (Win: WMI: (Get-CimInstance Win32_BIOS).SerialNumber; Mac: system_profiler SPHardwareDataType | grep 'Serial Number'; Lin: sudo dmidecode -s system-serial-number)
- SMBIOS UUID (Devices) (Win: WMI: (Get-CimInstance Win32_ComputerSystemProduct).UUID; Mac: system_profiler SPHardwareDataType | grep 'Hardware UUID'; Lin: sudo dmidecode -s system-uuid)
- Firmware/BIOS details (DeviceHardware.bios_info JSONB) including: Manufacturer, Version, Release Date, Secure Boot Status (Win: PS: Confirm-SecureBootUEFI or WMI Win32_SecureBoot; Mac: Check SIP status csrutil status / Startup Security Utility state; Lin: mokutil --sb-state or check /sys/firmware/efi/efivars/SecureBoot*)
- Chassis details (DeviceHardware.chassis_info JSONB) including: Manufacturer, Type, Serial (Win: WMI: Win32_SystemEnclosure; Mac: Infer from Model; Lin: dmidecode -t chassis, dmidecode -s chassis-*)
- Motherboard details (DeviceHardware.motherboard_info JSONB) including: Manufacturer, Product Name, Serial Number (Win: WMI: Win32_BaseBoard; Mac: N/A directly; Lin: dmidecode -s baseboard-*)
- CPU details (DeviceHardware.cpu_details JSONB) including Model String, Max Clock Speed, Core Count, Logical Processor Count, Architecture, Virtualization Support Flags (Win: WMI: Win32_Processor; Mac: sysctl machdep.cpu hw.*; Lin: /proc/cpuinfo, lscpu)
- Memory summary including Total Physical RAM, Slots Used/Total (DeviceHardware) (Win: WMI: Win32_ComputerSystem, WMI: Win32_PhysicalMemoryArray; Mac: sysctl hw.memsize, system_profiler SPMemoryDataType; Lin: /proc/meminfo, sudo dmidecode -t memory)
- Memory Module details including Slot, Capacity, Type, Speed, Manufacturer, Part Number, Serial Number (DeviceHardware.ram_details JSONB) (Win: WMI: Win32_PhysicalMemory; Mac: system_profiler SPMemoryDataType; Lin: sudo dmidecode -t memory)
- Physical Disk details including Model, Manufacturer, Serial Number, Firmware, Interface Type, Media Type (SSD/HDD), Capacity, SMART Status, Power-On Hours, and associated Storage Controller Link ID. (PhysicalDisks) (Methods: Win: WMI Win32_DiskDrive/Get-PhysicalDisk/Get-StorageReliabilityCounter; Mac: system_profiler/diskutil info/smartctl; Lin: lsblk/hdparm/smartctl/nvme)
- Storage Controllers: Identify installed storage controllers (SATA, NVMe, SCSI, RAID, HBA). Collect Name, Manufacturer, Model (where available), Driver Version. (Methods: Win: WMI Win32_SCSIController/IDEController, Get-PnpDevice; Mac: system_profiler SPStorageDataType/etc.; Lin: lspci -k, lsscsi). Stored locally in cache_storage_controllers.
- Network Adapter details including Name, Description, MAC Address, Manufacturer, Status (Up/Down), Link Speed (DeviceNetworkAdapters) (Methods: Win WMI Win32_NetworkAdapter/Get-NetAdapter; Mac networksetup/ifconfig; Lin ip link/lspci/lsusb)
- Video Controller details including Name, Manufacturer, Adapter RAM, WDDM Version (Win), DirectX Support Level (Win), Driver Version (DeviceHardware.video_controllers JSONB) (Methods: Win WMI Win32_VideoController; Mac system_profiler SPDisplaysDataType; Lin lspci/glxinfo)
- Sound Device details including Name, Manufacturer (DeviceHardware.sound_devices JSONB) (Methods: Win WMI Win32_SoundDevice; Mac system_profiler SPAudioDataType; Lin lspci/aplay -l)
- USB Controller details (DeviceHardware.usb_controllers JSONB) (Methods: Win WMI Win32_USBController; Mac system_profiler SPUSBDataType; Lin lsusb)
- Battery details including Status, Capacity, Health, Runtime estimates (DeviceBattery) (Methods: Win WMI Win32_Battery; Mac ioreg/pmset; Lin /sys/class/power_supply/BAT*)
- TPM Status including Presence, Enabled, Activated, Spec Version (Devices.configuration JSONB) (Methods: Win PS: Get-Tpm/WMI Win32_Tpm; Mac Secure Enclave status; Lin /dev/tpm*/tpm2-tools)
- System Firmware Type (UEFI) (DeviceHardware.bios_info JSONB) (Methods: Win Registry/systeminfo/WMI; Mac Assume UEFI; Lin Check /sys/firmware/efi)
- Hardware Sensor Readings: Temperatures (CPU, Zones), Fan Speeds (cache_sensor_readings) (Methods: Win WMI MSAcpi_ThermalZoneTemperature/Win32_Fan/Vendor WMI; Mac sudo powermetrics/ioreg; Lin lm-sensors//sys/class/thermal//sys/class/hwmon - Requires tools/config)
- Device Virtualization Type: Determine and report virtualization status code (1-5). Agent shall perform checks for guest status, platform hypervisor, Hyper-V role (vmms), and common Type 2 hypervisors. (Methods: As detailed previously). Stored locally in cache_device_summary.
- Operating System:
- OS Name, Version, Build, Arch, Edition/SKU, Install Date, Last Boot Time, Uptime, Language, Domain/Workgroup Membership, Domain Role. (Devices, OsUpgradeHistory) (Methods: WMI, Registry, sw_vers, uname, /etc/os-release, uptime, etc.)
- OS Activation Status, partial License Key (DeviceSoftware) (Win: WMI SoftwareLicensingProduct; Mac/Lin: N/A)
- Reboot Pending Status (Devices) (Methods: Check Win Registry/CBS, Mac/Lin /var/run/reboot-required)
- System Activity State: Last Input Timestamp, Screensaver Active, Session Locked (cache_device_summary) (Methods: OS APIs like GetLastInputInfo, SystemParametersInfo, WMI Win32_LogonSession, CGSessionCopyCurrentDictionary, X utils, DBus)
- Storage:
- Logical Disks/Volumes including Drive Letter/Mount Point, Volume Label, File System, Total Size, Free Space, Relationship to Underlying Physical Storage (Parent Type/IDs), and Is OS Drive flag. Agent shall identify and flag the logical disk containing the running OS. (DeviceLogicalDisks) (Methods: Win: WMI Win32_LogicalDisk, %SystemDrive%, Get-Volume | Get-Partition | Get-Disk; Mac: diskutil list/info, df; Lin: lsblk -f, df, check / mount point). Stored locally in cache_logical_disks.
- Mapped Network Drives (Letter, Path, User SID) (MappedNetworkDrives) (Methods: Win WMI Win32_MappedLogicalDisk/net use; Mac/Lin mount, check user context)
- Disk Encryption Status (Method, State, Protectors) (DeviceDiskEncryptionStatus) (Methods: manage-bde/WMI Win32_EncryptableVolume, fdesetup/diskutil, cryptsetup). Recovery Key handling as per Section 8.1.
- Network Configuration:
- Network Adapter IP config (DeviceNetworkAdapters) (Methods: WMI Win32_NetworkAdapterConfiguration/Get-NetIPConfiguration; Mac ifconfig/networksetup; Lin ip addr show)
- Static Routes (DeviceStaticRoutes) (Methods: WMI Win32_IP4RouteTable/route print; Mac/Lin netstat -nr)
- Current Wireless Connection details and list of visible SSIDs (WirelessNetworks) (Methods: Win netsh wlan; Mac airport/system_profiler; Lin iwconfig/nmcli)
- LLDP/CDP Neighbor information (NetworkConnections) (Requires external daemons/tools)
- Open Network Ports & PID (DeviceOpenPorts) (Methods: netstat, ss, Get-NetTCPConnection)
- Hyper-V Host Configuration (Windows Only): If Device Virtualization Type = 4, collect detailed host settings: Virtual Switches, Default Paths, Live Migration, Storage Migration, Replication, General Settings, Virtual SANs. Stored locally in cache_hyperv_* tables. (Methods: WMI root\virtualization\v2 namespace queries: Msvm_VirtualEthernetSwitch, Msvm_VirtualSystemManagementService, Msvm_VirtualSystemMigrationServiceSettingData, Msvm_ReplicationServiceSettingData, Msvm_VirtualSystemManagementServiceSettingData, Msvm_VirtualSan, etc.).
- Hyper-V VM Inventory (Windows Only): If Device Virtualization Type = 4, collect inventory of guest VMs: Name, GUID, State, Health, Status, CPU Count, Memory Assigned, Uptime, Guest OS/IPs (via KVP), Config Path, Notes. Stored locally in cache_hyperv_vms. (Methods: WMI root\virtualization\v2: Msvm_ComputerSystem, Msvm_SummaryInformation, Msvm_KvpExchangeComponent, etc.).
- Detailed collection for other hypervisor types (Type 5) is Post-V1
- Software & Services:
- Installed Applications (DeviceSoftware) (Methods: Win Registry Uninstall/Get-Package; Mac /Applications/system_profiler/pkgutil; Lin dpkg/rpm/snap/flatpak)
- Running Services (DeviceServices) (Methods: Win Get-Service/WMI; Mac launchctl list; Lin systemctl list-units)
- Running Processes (DeviceProcesses) (Methods: Win Get-Process/WMI; Mac ps aux; Lin ps aux)
- Startup Items (DeviceStartupItems) (Methods: Win Registry/Folders/Task Scheduler; Mac LaunchAgents/Daemons/Login Items; Lin systemd/cron/autostart)
- Device Driver Information (Provider, Version, Date, Signed, Associated PNPDeviceID) (cache_drivers) (Methods: Win WMI Win32_PNPSignedDriver; Mac system_profiler/kextstat; Lin lspci -k/lsusb -v/modinfo)
- Running status of known Backup Services (Methods: Get-Service, launchctl list, systemctl status)
- Web Browser Details: Browser Identification (Name, Version, Path, Default), Installed Extensions (ID, Name, Ver, Enabled, User Context), Key Security Policy Settings. Stored locally in cache_browsers, cache_browser_extensions, cache_browser_config. (Methods: Registry, File Properties, Profile Dirs, Plists, MDM Profiles, Package Managers)
- Local Security & Configuration:
- Local User Accounts (LocalUserAccounts) (Methods: Win WMI Win32_UserAccount; Mac dscl; Lin /etc/passwd)
- Local Groups (LocalGroups) (Methods: Win WMI Win32_Group; Mac dscl; Lin /etc/group)
- Local Group Memberships (LocalGroupMemberships) (Methods: Win WMI/net localgroup; Mac dscl; Lin getent group)
- Local User Profile Details (Path, Size, Status, Last Used, Password Age) (cache_local_user_profiles) (Methods: Win WMI Win32_UserProfile/Win32_NetworkLoginProfile + Size Calc; Mac /Users//du/stat/pwpolicy; Lin /home//du/stat/chage)
- Local Security/Password Policy Settings (LocalSecurityPolicySettings) (Methods: Win secedit /export; Mac pwpolicy/security; Lin /etc/login.defs/PAM)
- Detailed Audit Policy Settings (cache_audit_policy) (Methods: Win auditpol /get; Mac audit_control -p; Lin auditctl -l)
- Windows Firewall Profiles & Rules configuration (DeviceFirewallProfiles, DeviceFirewallRules) (Methods: Win netsh/Get-NetFirewall*; Mac socketfilterfw/pfctl; Lin iptables/nft/ufw)
- EPP/AV Status (OS-Level visibility for 3rd party) (EndpointProtectionStatus) (Methods: Win WMI SecurityCenter2; Mac/Lin Service/Process checks)
- Detailed Microsoft Defender Configuration (cache_defender_config) (Methods: Win PS: Get-MpPreference)
- Network Shares hosted locally & their Share Permissions (NetworkShares, SharePermissions) (Methods: Win WMI Win32_Share/net share; Mac sharing/smbutil; Lin Samba tools/config)
- NTFS Permissions (FileSystemPermissions) (Methods: Win icacls/Get-Acl; Mac/Lin ls -le/getfacl - if enabled)
- Installed Printers (DevicePrinters) (Methods: Win WMI Win32_Printer; Mac/Lin lpstat -p)
- Monitored Registry Values (MonitoredRegistryValues) (Methods: Win Registry API - based on config)
- Scheduled Tasks (DeviceScheduledTasks) (Methods: Win schtasks/API; Mac launchctl list; Lin crontab/systemd timers)
- Session Info: Active user sessions (DeviceSessions) (Methods: Win query user/WMI; Mac who/last; Lin who/last)
- History: OS Upgrades (OsUpgradeHistory) (Methods: Win Registry/Logs; Mac Plist/Logs; Lin Package Logs)
- 3.4. Data Polling & Caching Strategy:
- Polling Cycle: Agent performs data collection cycles for inventory, performance snapshots, and security state information.
- Default Frequency: Every 300 seconds (5 minutes).
- Fast Polling Mode Frequency: Every 30 seconds (entered/exited via server command).
- On-Demand Trigger: Supports immediate full data collection via server command. (not delta)
- Local Caching Mechanism (SQLite): Uses _live and _committed table pairs for delta tracking (See Section 4.1).
- Data Scope: Polling cycle collects data for categories listed under Inventory (3.3), Performance (3.4.1), and Security State (3.5). Event Logs and Active Application Tracking use separate mechanisms (3.6, 3.11).
- 3.4.1 Performance Monitoring Data Collection:
- System Metrics: Collects core system performance metrics (CPU Usage %, RAM Usage %, Disk IOPS/Latency/Queue Length, Network Adapter Throughput) as part of the main polling cycle (300s/30s). Populates DevicePerformanceSnapshots. (Methods: Perfmon, sysctl, iostat, /proc/*stats).
- Process Metrics: Collects resource usage (CPU, Memory, Disk/Network IO) for running processes as part of the main polling cycle. Populates DeviceProcesses. (Methods: WMI, ps, /proc/[pid]/stat).
- 3.5. Security State Monitoring Data Collection: (Collection follows the polling cycle defined in 3.4)
- Collects EPP/AV Status (OS-Level for 3rd party), detailed Microsoft Defender Configuration, Firewall Status & Config/Rules, Patch Status, Compliance Results, Local Policy Settings, Disk Encryption Status & Recovery Key (securely handled per 8.1), Secure Boot Status. Populates respective tables using methods outlined in 3.3.
- 3.6. Event Log Monitoring:
- Configuration & Polling: Receives definitions (EventLogDefinitions). Polls configured logs every 300 seconds (configurable).
- Local State Tracking: Uses cache_eventlog_position locally to track last processed event record ID/marker per source.
- Upload: Uploads new, matching events immediately after the polling cycle completes. These events populate the server-side DeviceEventLogs table.
- Agent Responsibility (Data for Server Dedupe): Agent must extract and transmit a unique source instance identifier (e.g., OS Event Record ID) for each event log entry to the server.
- 3.7. Real-time Monitoring (UI Triggered):
- Supports entering/exiting "Fast Polling Mode" (30s cycle for data in Sec 3.4) based on server command received during 60s check-in. Applies to Services, Processes, Battery, Performance Metrics.
- 3.8. [moved to post v1]
- 3.9. Command Execution:
- Purpose: Allow execution of scripts/commands received from the server.
- Mechanism: Agent receives command details from AgentCommandQueue during 60s check-in.
- Execution Contexts: Command payload specifies context. Agent must support:
- System (Default): Executes as LocalSystem/root.
- LoggedInUser: Executes as the active logged-in user (requires IPC with user session helper process).
- Execution & Timeout: Agent initiates process in specified context, enforces timeout from command details (default 300s), attempts termination on timeout.
- Results Reporting: Agent reports status, exit code, stdout, stderr back to AgentCommandQueue.
- 3.10. Location Detection:
- Purpose: To determine and report the approximate geographical location of the managed endpoint when the feature is explicitly enabled and OS/user permissions allow.
- Activation & Control: This feature must be explicitly enabled via server-side policy (e.g., within AgentConfigurations or a dedicated policy). If disabled by policy, the agent must not attempt to collect or report location data (beyond the basic External IP Geolocation performed server-side). Furthermore, collection relies on OS-level location services which typically require end-user consent configured via OS privacy settings.
- Data Collected: When enabled and permitted, the agent shall attempt to collect:
- Latitude (Decimal Degrees)
- Longitude (Decimal Degrees)
- Accuracy (Estimated radius in meters)
- TimestampUTC (When the location was determined)
- Source Method (e.g., 'OS_GPS', 'OS_WiFi', 'OS_Network', 'IP_Geolocation')
- Collection Methods & Priority: The agent service shall attempt to retrieve location data using the following methods in order of preference:
- OS Location Services (Primary): Utilize platform-native location service APIs if available and enabled/permitted by the user.
- (Win: Windows.Devices.Geolocation API; Mac: Core Location framework; Lin: GeoClue service via D-Bus). This can provide varying accuracy based on available hardware (GPS, WiFi positioning, cellular). The agent shall report the accuracy provided by the OS API.
- (Fallback - Server-Side): If OS Location Services are unavailable, disabled, or permission is denied, the agent shall not attempt lower-precision methods like browser geolocation itself. Instead, the CommandIT server backend can perform a GeoIP lookup based on the agent's reported external_ip_address (Devices table) as a last resort. This provides only approximate ISP/city-level location.
- Frequency: Location data collection occurs as part of the main data polling cycle (Section 3.4).
- Storage: The most recently collected location data shall be stored server-side (updating fields like Devices.last_reported_latitude, Devices.last_reported_longitude, Devices.last_location_report_timestamp, plus new fields Devices.last_location_accuracy_meters, Devices.last_location_source). This data is cached locally in cache_device_summary for delta sync.
- 3.11. Active Application Tracking:
- Purpose: Monitor and record the foreground application being actively used within each user session. (Note: Deployment requires consideration of user privacy).
- Activation & Control: Feature activation must be controlled server-side through hierarchical settings (Org/Location/Device). Agent shall receive the final 'Enabled' or 'Disabled' state via its configuration profile. If disabled, agent must not monitor or upload activity data.
- Monitoring: When enabled, agent monitors foreground window changes for logged-in user sessions.
- Data Collected per Activity Period: Application Name, Process Name, Window Title, URL (best effort for browsers), Start Time, End Time, Duration, User Session Identifier.
- Collection Methods: (Win: GetForegroundWindow/GetWindowText/etc., UI Automation; Mac: NSWorkspace/Accessibility APIs; Lin: X11 Props/Accessibility APIs/Wayland).
- Local Storage & Upload: Buffers records locally in cache_user_activity_log. Uploads periodically in batches. Does not use delta sync.
- 3.12. Uninstallation (Default Silent):
- Purpose: Completely remove agent suite and configuration.
- Commands: Platform-specific (agent.exe uninstall, uninstall.sh). Requires Admin/root.
- Behavior: Stops/deregisters services. Removes files/dirs, registry/plists, including identity (deviceId/secret). Attempts best-effort API de-registration. Optional --preserve-logs. Uses standard return codes. Logs locally.
- 3.13. Repair:
- Purpose: Reset local caches/state without full reinstall/re-registration.
- Command: Platform-specific (agent.exe repair [--wipe-data]). Requires Admin/root.
- Behavior: Standard clears config cache (forces re-download). --wipe-data also clears local operational state/queues (_committed tables, outbound queue), forcing full data sync. Preserves identity (deviceId/secret). Logs action locally.
4. Data Handling
- 4.1. Local SQLite Cache Structure:
- 4.1.1. Agent Configuration & Identity: cache_agent_config (key/value store; excludes raw device_secret).
- 4.1.2. Delta Synchronization Cache (_live / _committed Pairs):
- Purpose: To track changes in inventory, status, and configuration data collected during polling cycles (defined in Section 3.3) and upload only the differences (deltas) to the server.
- Mechanism: For each relevant data category, two tables with identical schemas exist: cache_[category]_live and cache_[category]_committed.
- _live tables: Contain the results of the most recent data collection poll for that category. This table is overwritten or updated during each poll.
- _committed tables: Contain the data state that was last successfully synchronized with the CommandIT server.
- Delta Process:
- Agent polls data and populates the _live table(s).
- Agent compares _live data against _committed data.
- Differences (new, changed, deleted records) constitute the delta payload.
- Agent uploads the delta payload via the API.
- Upon server confirmation of successful upload, the agent replaces the content of the _committed table(s) with the content of the _live table(s).
- Full Sync Process: A full resync is triggered daily (scheduled) or on-demand by clearing the relevant _committed tables. This forces the next comparison to treat all current _live data as new, resulting in a full upload for that category. (Event log tracking uses a separate mechanism and is excluded from this clearing process).
- Conceptual Delta Tables (Includes all V1 items):
- cache_device_summary_live/_committed (incl. activity state, virtualization_type)
- cache_hardware_summary_live/_committed (incl. secure boot, tpm, uefi status)
- cache_ram_modules_live/_committed
- cache_physical_disks_live/_committed (incl. power-on hours, storage_controller_link_id)
- cache_logical_disks_live/_committed (incl. is_os_drive, parent_type, parent_identifiers)
- cache_network_adapters_live/_committed (incl. manufacturer)
- cache_installed_software_live/_committed
- cache_local_users_live/_committed (incl. derived password flags)
- cache_local_groups_live/_committed
- cache_local_group_members_live/_committed
- cache_local_user_profiles_live/_committed (incl. size, status, last used, password age)
- cache_printers_live/_committed
- cache_shares_live/_committed
- cache_share_permissions_live/_committed
- cache_firewall_profiles_live/_committed
- cache_firewall_rules_live/_committed
- cache_epp_status_live/_committed (incl. configuration_details JSONB for Defender)
- cache_disk_encryption_live/_committed (Excludes encrypted key, status only)
- cache_patch_status_live/_committed
- cache_compliance_results_live/_committed
- cache_startup_items_live/_committed
- cache_sessions_live/_committed
- cache_static_routes_live/_committed
- cache_mapped_drives_live/_committed
- cache_monitored_registry_live/_committed
- cache_battery_info_live/_committed
- cache_os_history_live/_committed
- cache_sensor_readings_live/_committed
- cache_drivers_live/_committed (incl. pnp_device_id)
- cache_browsers_live/_committed
- cache_browser_extensions_live/_committed
- cache_browser_config_live/_committed
- cache_audit_policy_live/_committed
- cache_storage_controllers_live/_committed
- cache_hyperv_host_config_live/_committed
- cache_hyperv_virtual_switches_live/_committed
- cache_hyperv_virtual_sans_live/_committed
- cache_hyperv_lm_networks_live/_committed
- cache_hyperv_vms_live/_committed
- 
- 4.1.3. Event Log State: cache_eventlog_position (PK log_source_identifier, last_record_id, last_event_timestamp).
- 4.1.4. Outbound Data Queue: cache_outbound_queue (PK queue_id, payload_type, payload BLOB, added_timestamp, retry_count). Sensitive data in payload MUST be encrypted per Section 8.1.
- 4.1.5. User Activity Log Buffer: cache_user_activity_log (PK activity_log_id, user_session_identifier, application_name, process_name, window_title, url, start_time_utc, end_time_utc, duration_seconds, upload_status). (Does not use delta sync).
- 4.2. Agent Local Cache Pruning and Management:
- To maintain performance and prevent excessive disk usage, the agent must manage its cache:
- cache_outbound_queue Management: Apply limits (whichever is reached first):
- Age Limit: Prune data older than configurable limit (default 14 days).
- Size Limit: Prune oldest data (FIFO) if total cache size exceeds configurable limit (default 250 MB).
- cache_user_activity_log Management: Apply limits (whichever is reached first):
- Age Limit: Prune data older than configurable limit (default 3 days).
- Size Limit: Prune oldest data (FIFO) if table size exceeds configurable limit (default 100 MB).
- 4.3. Notes on Server-Side Event Log Deduplication:
- While the agent uses cache_eventlog_position to avoid reprocessing events during normal operation, the ultimate safeguard against duplicate event entries in the CommandIT platform (especially after an agent reinstall, cache issues, or log rollovers) resides on the server-side.
- The CommandIT server backend must utilize the combination of the reporting agent's device_id and the unique source_event_record_id (provided by the agent with each event) to check for existing entries before inserting new records into the DeviceEventLogs table. Matching entries based on this composite key should be discarded as duplicates.
5. Configuration
- Agent configured primarily via server policies (AgentConfigurations, MonitoringPolicies, etc.) fetched during check-in.
- Server policies control feature enablement (including evaluating hierarchical settings for features like Active Application Tracking), polling intervals, monitoring targets, update policies, log levels, and other operational parameters.
- The agent shall apply the effective configuration state received from the server.
6. Performance & Resource Management
- Target low baseline resource usage (e.g., <2% avg CPU, <200MB RAM).
- Resource-intensive scans (Inventory, Patch Status, Compliance, FIM, PII, detailed profile size/NTFS perms, Audit Policy) must be throttled and/or scheduled via server policy to minimize user impact. Agent activity tracking must also be efficient.
- Agent monitors own resource usage.
7. Error Handling & Logging
- Retry mechanisms for transient network/API errors.
- Local file-based, rotating logs with configurable level (AgentConfigurations.log_level).
- Reports critical errors to the server.
8. Security Considerations
- 8.1. Handling of Highly Sensitive Data (Recovery Keys):
- The agent is required to collect BitLocker/FileVault recovery keys where possible. Due to extreme sensitivity, these handling procedures must be strictly implemented:
- 8.1.1. Immediate Asymmetric Encryption: Recovery keys must be encrypted immediately upon collection using asymmetric cryptography before caching or transmission.
- 8.1.2. Server-Provided Public Key: Encryption must use a public key provided securely by the CommandIT server.
- 8.1.3. No Unencrypted Caching or Logging: Raw recovery keys must never be written unencrypted to the local cache or log files. Only encrypted blobs are queued/stored temporarily.
- 8.1.4. Secure Transmission: Uploads containing encrypted keys must use validated TLS 1.2+.
- 8.2. General Security:
- Secure enrollment (Embedded MSP ID + Org/Loc validation; Technician auth for manual).
- Secure communication (TLS). Authenticated via unique deviceId/secret.
- Agent identity (secret) stored securely locally (DPAPI/Keychain).
- Agent process hardening and file protection required.
- Requires elevated privileges (System/root) but uses least privilege for specific tasks where feasible.
- Secure handling/retrieval of any credentials needed for local integrations.
- 8.3. Privacy Considerations for Activity Tracking:
- The Active Application Tracking feature (Section 3.11) collects detailed usage information. Deployment must comply with local privacy regulations and organizational policies. Clear communication/consent may be required. This specification does not include screenshot capture or keystroke logging functionality.
9. Platform Support
- Windows: 10, 11, Server 2016, 2019, 2022+ (32-bit and 64-bit x86_64; 64-bit ARM64). (Note: Feature parity, especially for deep hardware/driver details, requires specific testing on ARM64).
- macOS: Latest 3 major versions (Supporting both Intel (x86_64) and Apple Silicon (ARM64) architectures via Universal Binary). (Note: Specific data collection methods for sensors, firmware, drivers etc., require distinct implementations for Intel vs. Apple Silicon).
- Linux: Ubuntu LTS 18.04+, RHEL/CentOS/Rocky 7+, Debian 10+ (64-bit x86_64). (Note: Requires common utilities like dmidecode, lsblk, iproute2. Tools like lm-sensors, smartctl, mokutil may be needed for full data collection and might require installation/configuration.)