Add server update alerting and fleet client auto-update system (synchronized release lockstep)
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 1m14s

This commit is contained in:
2026-10-02 22:08:51 +02:00
parent f2a9e43619
commit 2c08f9fc15
11 changed files with 1216 additions and 31 deletions
+18 -3
View File
@@ -26,6 +26,12 @@ from log_collector import (
resolve_writable_path,
collect_system_metrics
)
try:
from src.version import LOGAR_VERSION
from src.client_updater import ClientUpdater
except ImportError:
from version import LOGAR_VERSION
from client_updater import ClientUpdater
CONFIG_FILE_NAME = "client_config.json"
@@ -75,7 +81,8 @@ def enroll_client_if_needed(
"client_id": client_id,
"hostname": hostname,
"os": os_type,
"enrollment_secret": enrollment_secret
"enrollment_secret": enrollment_secret,
"version": LOGAR_VERSION
}
req = urllib.request.Request(
enroll_endpoint,
@@ -249,7 +256,8 @@ def send_encrypted_logs_over_socket(
"server": actual_machine_id,
"timestamp": datetime.now(timezone.utc).isoformat(),
"logs": logs,
"metrics": collect_system_metrics()
"metrics": collect_system_metrics(),
"version": LOGAR_VERSION
}
payload_bytes = json.dumps(payload).encode("utf-8")
frame = struct.pack(">I", len(payload_bytes)) + payload_bytes
@@ -286,7 +294,8 @@ def send_encrypted_logs_over_socket(
"server": actual_machine_id,
"timestamp": datetime.now(timezone.utc).isoformat(),
"logs": logs,
"metrics": collect_system_metrics()
"metrics": collect_system_metrics(),
"version": LOGAR_VERSION
}
payload_json = json.dumps(payload)
pgp_msg = pgpy.PGPMessage.new(payload_json)
@@ -323,3 +332,9 @@ def send_encrypted_logs_over_socket(
response = json.loads(resp_bytes.decode("utf-8"))
print(f"[+] Server response: {response}")
return response
def check_and_apply_auto_update(config: dict, machine_id: str, os_type: Optional[str] = None, auto_apply: bool = True) -> Dict[str, Any]:
"""Helper to check and apply auto updates for edge forwarders."""
updater = ClientUpdater(config=config, os_type=os_type)
return updater.check_and_apply_auto_update(client_id=machine_id, auto_apply=auto_apply)