feat: soporte Android/Termux — battery_file + log_file (file-IPC sin exec), tail de logcat, workarounds DNS(1.1.1.1)+CA(SSL_CERT_FILE), procesos Android-safe

This commit is contained in:
Egutierrez
2026-06-07 14:25:45 +02:00
parent 2176e9d442
commit b7e3c80f4c
3 changed files with 209 additions and 4 deletions
+14
View File
@@ -16,6 +16,14 @@ type Config struct {
User string `json:"user"` // basic-auth user, shared by metrics and logs (empty disables auth)
Pass string `json:"pass"` // basic-auth password
IntervalSec int `json:"interval_sec"` // metrics push period in seconds (default 15)
// Android/Termux exec workaround: the standard Go binary cannot exec
// subprocesses there (seccomp blocks pidfd_open with SIGSYS). When set, the
// agent reads battery JSON from this file (written by a shell helper) instead
// of running termux-battery-status itself.
BatteryFile string `json:"battery_file"`
// When set, the agent tails this log file (written by a shell `logcat`
// helper) and ships it to Loki, instead of exec-ing journald/logcat.
LogFile string `json:"log_file"`
}
// defaultConfig returns the baseline configuration: the machine hostname as the
@@ -48,6 +56,12 @@ func loadConfig(path string) (Config, error) {
if v := os.Getenv("FLEET_LOKI_URL"); v != "" {
cfg.LokiURL = v
}
if v := os.Getenv("FLEET_BATTERY_FILE"); v != "" {
cfg.BatteryFile = v
}
if v := os.Getenv("FLEET_LOG_FILE"); v != "" {
cfg.LogFile = v
}
if v := os.Getenv("FLEET_USER"); v != "" {
cfg.User = v
}