2 AGL framework, overview of the proposal of IoT.bzh
3 ==================================================
12 This document describes what we intend to do. It may happen that our
13 current implementation and the content of this document differ.
15 In case of differences, it is assumed that this document is right
16 and the implementation is wrong.
22 During the first works in having the security model of Tizen
23 integrated in AGL (Automotive Grade Linux) distribution, it became
24 quickly obvious that the count of components specific to Tizen
25 to integrate was huge.
27 Here is a minimal list of what was needed:
29 - platform/appfw/app-installers
30 - platform/core/security/cert-svc
31 - platform/core/appfw/ail
32 - platform/core/appfw/aul-1
33 - platform/core/appfw/libslp-db-util
34 - platform/core/appfw/pkgmgr-info
35 - platform/core/appfw/slp-pkgmgr
37 But this list is complete because many dependencies are hidden.
38 Those hidden dependencies are including some common libraries but also many
39 tizen specific sub-components (iniparser, bundle, dlog, libtzplatform-config,
40 db-util, vconf-buxton, ...).
42 This is an issue because AGL is not expected to be Tizen. Taking it would
43 either need to patch it for removing unwanted components or to take all
46 However, a careful study of the core components of the security framework
47 of Tizen showed that their dependencies to Tizen are light (and since some
48 of our work, there is no more dependency to tizen).
49 Those components are **cynara**, **security-manager**, **D-Bus aware of cynara**.
51 Luckyly, these core security components of Tizen are provided
52 by [meta-intel-iot-security][meta-intel], a set of yocto layers.
53 These layers were created by Intel to isolate Tizen specific security
54 components from the initial port of Tizen to Yocto.
55 The 3 layers are providing components for:
57 * Implementing Smack LSM
58 * Implementing Integrity Measurement Architecture
59 * Implementing Tizen Security Framework
61 The figure below shows the history of these layers.
65 Tizen OBS ----------+--------------------------->
68 Tizen Yocto +---------+-------------->
71 meta-intel-iot-security +----------->
73 We took the decision to use these security layers that provides the
74 basis of the Tizen security, the security framework.
76 For the components of the application framework, built top of
77 the security framework, instead of pulling the huge set of packages
78 from Tizen, we decided to refit it by developping a tiny set of
79 components that would implement the same behaviour but without all
80 the dependencies and with minor architectural improvements for AGL.
82 These components are **afm-system-daemon** and **afm-user-daemon**.
83 They provides infrastructure for installing, uninstalling,
84 launching, terminating, stopping and resuming applications in
85 a multi user secure environment.
87 A third component exists in the framework, the binder **afb-daemon**.
88 The binder provides the easiest way to provide secured API for
89 any tier. Currently, the use of the binder is not absolutely mandatory.
91 This documentation explains the framework created by IoT.bzh
92 by rewriting the Tizen Application Framework. Be aware of the
99 The figure below shows the major components of the framework
100 and their interactions going through the following scenario:
101 APPLICATION installs an other application and then launch it.
103 +-----------------------------------------------------------------------+
105 | ................................ |
106 | : Smack isolation context : |
107 | : : ........................... |
108 | : +-----------------------+ : : Smack isolation context : |
110 | : | APPLICATION | : : OTHER application : |
111 | : | | : :.........................: |
112 | : +-----------+-----------+ : ^ |
114 | : |(1),(7) : |(13) |
116 | : +-----------v-----------+ : +---------+---------------+ |
117 | : | binder afb-daemon | : | | |
118 | : +-----------------------+ : | afm-user-daemon | |
119 | : | afm-main-plugin | : | | |
120 | : +-----+--------------+--+ : +------^-------+------+---+ |
121 | :........|..............|......: | | : |
122 | |(2) |(8) |(10) | : |
124 | | +----v--------------------+---+ | : |
125 | | | D-Bus session | |(11) :(12) |
126 | | +-------------------------+---+ | : |
130 :===========|===================================|=======|======:========:
132 | | +---v-------v--+ : |
133 | +------v-------------+ (3) | | : |
134 | | D-Bus system +-----------------> CYNARA | : |
135 | +------+-------------+ | | : |
136 | | +------^-------+ : |
139 | +------v--------------+ +---------+---------------+ |
141 | | afm-system-daemon +-------------> SECURITY-MANAGER | |
143 | +---------------------+ +-------------------------+ |
146 +-----------------------------------------------------------------------+
148 Let follow the sequence of calls:
150 1. APPLICATION calls its **binder** to install the OTHER application.
152 2. The plugin **afm-main-plugin** of the **binder** calls, through
153 **D-Bus** system, the system daemon to install the OTHER application.
155 3. The system **D-Bus** checks wether APPLICATION has the permission
156 or not to install applications by calling **CYNARA**.
158 4. The system **D-Bus** transmits the request to **afm-system-daemon**.
160 **afm-system-daemon** checks the application to install, its
161 signatures and rights and install it.
163 5. **afm-system-daemon** calls **SECURITY-MANAGER** for fullfilling
164 security context of the installed application.
166 6. **SECURITY-MANAGER** calls **CYNARA** to install initial permissions
169 7. APPLICATION call its binder to start the nearly installed OTHER application.
171 8. The plugin **afm-main-plugin** of the **binder** calls, through
172 **D-Bus** session, the user daemon to launch the OTHER application.
174 9. The session **D-Bus** checks wether APPLICATION has the permission
175 or not to start an application by calling **CYNARA**.
177 10. The session **D-Bus** transmits the request to **afm-user-daemon**.
179 11. **afm-user-daemon** checks wether APPLICATION has the permission
180 or not to start the OTHER application **CYNARA**.
182 12. **afm-user-daemon** uses **SECURITY-MANAGER** features to set
183 the seciruty context for the OTHER application.
185 13. **afm-user-daemon** launches the OTHER application.
187 This scenario does not cover all the features of the frameworks.
188 Shortly because details will be revealed in the next chapters,
191 * ***SECURITY-MANAGER***: in charge of setting Smack contexts and rules,
192 of setting groups, and, of creating initial content of *CYNARA* rules
195 * ***CYNARA***: in charge of handling API access permissions by users and by
198 * ***D-Bus***: in charge of checking security of messaging. The usual D-Bus
199 security rules are enhanced by *CYNARA* checking rules.
201 * ***afm-system-daemon***: in charge of installing and uninstalling applications.
203 * ***afm-user-daemon***: in charge of listing applications, querying application details,
204 starting, terminating, stopping, resuming applications and their instances
205 for a given user context.
207 * ***afb-binder***: in charge of serving resources and features through an
210 * ***afm-main-plugin***: This plugin allows applications to use the API
211 of the AGL framework.
214 Links between the "Security framework" and the "Application framework"
215 ----------------------------------------------------------------------
217 The security framework refers to the security model used to ensure
218 security and to the tools that are provided for implementing that model.
220 The security model refers to how DAC (Discretionnary Access Control),
221 MAC (Mandatory Access Control) and Capabilities are used by the system
222 to ensure security and privacy. It also includes features of reporting
223 using audit features and by managing logs and alerts.
225 The application framework manages the applications:
226 installing, uninstalling, starting, stopping, listing ...
228 The application framework uses the security model/framework
229 to ensure the security and the privacy of the applications that
232 The application framework must be compliant with the underlyiong
233 security model/framework. But it should hide it to the applications.
236 The security framework
237 ----------------------
239 The implemented security model is the security model of Tizen 3.
240 This model is described [here][tizen-secu-3].
242 The security framework then comes from Tizen 3 but through
244 It includes: **Security-Manager**, **Cynara**
245 and **D-Bus** compliant to Cynara.
247 Two patches are applied to the security-manager. These patches are removing
248 dependencies to packages specific of Tizen but that are not needed by AGL.
249 None of these patches adds or removes any behaviour.
251 **Theoritically, the security framework/model is an implementation details
252 that should not impact the layers above the application framework**.
254 The security framework of Tizen provides "nice lad" a valuable component to
255 scan log files and analyse auditing. This component is still in developement.
258 The application framework
259 -------------------------
261 The application framework on top of the security framework
262 provides the components to install and uninstall applications
263 and to run it in a secured environment.
265 The goal is to manage applications and to hide the details of
266 the security framework to the applications.
268 For the reasons explained in introduction, we did not used the
269 application framework of Tizen as is but used an adaptation of it.
271 The basis is kept identical: the applications are distributed
272 in a digitally signed container that must match the specifications
273 of widgets (web applications). This is described by the technical
274 recomendations [widgets] and [widgets-digsig] of the W3 consortium.
276 This model allows the distribution of HTML, QML and binary applications.
278 The management of signatures of the widget packages
279 This basis is not meant as being rigid and it can be extended in the
280 futur to include for example incremental delivery.
285 [meta-intel]: https://github.com/01org/meta-intel-iot-security "A collection of layers providing security technologies"
286 [widgets]: http://www.w3.org/TR/widgets "Packaged Web Apps"
287 [widgets-digsig]: http://www.w3.org/TR/widgets-digsig "XML Digital Signatures for Widgets"
288 [libxml2]: http://xmlsoft.org/html/index.html "libxml2"
289 [openssl]: https://www.openssl.org "OpenSSL"
290 [xmlsec]: https://www.aleksey.com/xmlsec "XMLSec"
291 [json-c]: https://github.com/json-c/json-c "JSON-c"
292 [d-bus]: http://www.freedesktop.org/wiki/Software/dbus "D-Bus"
293 [libzip]: http://www.nih.at/libzip "libzip"
294 [cmake]: https://cmake.org "CMake"
295 [security-manager]: https://wiki.tizen.org/wiki/Security/Tizen_3.X_Security_Manager "Security-Manager"
296 [app-manifest]: http://www.w3.org/TR/appmanifest "Web App Manifest"
297 [tizen-security]: https://wiki.tizen.org/wiki/Security "Tizen security home page"
298 [tizen-secu-3]: https://wiki.tizen.org/wiki/Security/Tizen_3.X_Overview "Tizen 3 security overview"