From 9d0fd2ca670956d923755b555dc80c6f0c461965 Mon Sep 17 00:00:00 2001 From: Joe Particle Date: Wed, 16 Jul 2025 04:53:23 +0000 Subject: [PATCH] feat: Fix D-Bus type compatibility and establish successful daemon communication - Fix D-Bus type errors by flattening status dictionary - Remove nested 'config' dictionary that caused TypeError - Convert all values to D-Bus-compatible types (string, int, bool, double) - Confirm production security policy working (root-only access) - Successfully test GetStatus method with valid response - Update D-Bus policy to allow root access to specific interfaces - Update CHANGELOG.md with D-Bus communication milestone - Update TODO.md to reflect completed daemon integration The apt-ostree daemon now has working D-Bus communication with proper type handling and production-ready security policies. Ready for full integration with apt-layer.sh client. --- TODO.md | 9 ++++-- src/apt-layer/CHANGELOG.md | 31 +++++++++++++++++++ .../dbus-policy/org.debian.aptostree1.conf | 2 ++ src/apt-ostree.py/python/core/daemon.py | 10 +++--- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 7d28d08..206da81 100644 --- a/TODO.md +++ b/TODO.md @@ -35,8 +35,13 @@ ### VM Testing & Daemon Integration - ✅ VM environment setup and apt-layer/apt-ostree integration testing -- 🔄 Diagnosing daemon startup issue: Python entry point not launching daemon as expected -- 🔄 Next: Verify Python package install, test running daemon directly, fix entry point/install process +- ✅ Daemon startup and D-Bus registration working correctly +- ✅ D-Bus communication established with proper method signatures +- ✅ D-Bus type compatibility resolved (flattened status dictionary) +- ✅ Production security policy confirmed (root-only access) +- ✅ GetStatus method tested and returning valid responses +- 🎯 Next: Implement additional D-Bus methods (InstallPackages, RemovePackages, etc.) +- 🎯 Next: Integrate with apt-layer.sh client for full daemon orchestration ## Next Phase 🎯 diff --git a/src/apt-layer/CHANGELOG.md b/src/apt-layer/CHANGELOG.md index 770ca96..c5424be 100644 --- a/src/apt-layer/CHANGELOG.md +++ b/src/apt-layer/CHANGELOG.md @@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### [2025-07-16 UTC] - DAEMON INTEGRATION: D-BUS COMMUNICATION SUCCESSFUL +- **Major Milestone**: Successfully established D-Bus communication with apt-ostree daemon. +- **D-Bus Method Testing**: Successfully tested `GetStatus` method with proper D-Bus type handling: + - Method call: `org.debian.aptostree1.Sysroot.GetStatus` + - Object path: `/org/debian/aptostree1/Sysroot` + - Interface: `org.debian.aptostree1.Sysroot` + - Valid response with daemon status information +- **D-Bus Type Compatibility**: Fixed D-Bus type errors by flattening status dictionary: + - Removed nested `config` dictionary that caused `TypeError` + - Converted all values to D-Bus-compatible types (string, int, bool, double) + - Ensured all returned values are simple, serializable types +- **Production Security**: Confirmed root-only D-Bus policy is working correctly: + - Non-root users receive `AccessDenied` (expected) + - Root users can successfully call D-Bus methods + - Policy file properly installed and D-Bus reloaded +- **Daemon Status Response**: Confirmed daemon returns comprehensive status: + - `running`: boolean true (daemon is active) + - `clients`: int32 0 (no active clients) + - `active_transactions`: int32 0 (no active transactions) + - `sysroot_path`: string "/" (system root path) + - `uptime`: double (daemon uptime in seconds) + - `idle_exit_timeout`: int32 60 (idle timeout configuration) + - `auto_update_policy`: string "none" (update policy setting) +- **Integration Readiness**: Daemon is now ready for full integration: + - ✅ D-Bus communication working + - ✅ Security policy enforced + - ✅ Method signatures correct + - ✅ Type compatibility resolved + - ✅ Status reporting functional +- **Next Steps**: Ready to implement additional D-Bus methods and integrate with apt-layer.sh client. + ### [2025-07-16 UTC] - PRODUCTION SECURITY: D-BUS POLICY HARDENING - **Production Security Enhancement**: Updated D-Bus policy for production use with root-only access. - **D-Bus Policy Hardening**: Modified `src/apt-ostree.py/dbus-policy/org.debian.aptostree1.conf`: diff --git a/src/apt-ostree.py/dbus-policy/org.debian.aptostree1.conf b/src/apt-ostree.py/dbus-policy/org.debian.aptostree1.conf index 74b389c..6fd1189 100644 --- a/src/apt-ostree.py/dbus-policy/org.debian.aptostree1.conf +++ b/src/apt-ostree.py/dbus-policy/org.debian.aptostree1.conf @@ -6,6 +6,8 @@ + + diff --git a/src/apt-ostree.py/python/core/daemon.py b/src/apt-ostree.py/python/core/daemon.py index 5601846..91f5b47 100644 --- a/src/apt-ostree.py/python/core/daemon.py +++ b/src/apt-ostree.py/python/core/daemon.py @@ -331,10 +331,8 @@ class AptOstreeDaemon(GObject.Object): 'running': self.running, 'clients': len(self.client_manager.clients), 'active_transactions': len(self.active_transactions), - 'sysroot_path': self.sysroot.path if self.sysroot else None, - 'uptime': time.time() - getattr(self, '_start_time', time.time()), - 'config': { - 'idle_exit_timeout': self.idle_exit_timeout, - 'auto_update_policy': self.auto_update_policy - } + 'sysroot_path': str(self.sysroot.path) if self.sysroot else "", + 'uptime': float(time.time() - getattr(self, '_start_time', time.time())), + 'idle_exit_timeout': int(self.idle_exit_timeout), + 'auto_update_policy': str(self.auto_update_policy) } \ No newline at end of file