0c67b6351e89c8c31100f5534ff6f9a71e80355a
[src/app-framework-main.git] / doc / overview.html
1 <html>
2 <head>
3   <link rel="stylesheet" type="text/css" href="doc.css">
4   <meta charset="UTF-8">
5 </head>
6 <body>
7 <a name="AGL.framework..overview.of.the.proposal.of.IoT.bzh"></a>
8 <h1>AGL framework, overview of the proposal of IoT.bzh</h1>
9
10 <pre><code>version: 1
11 Date:    15 March 2016
12 Author:  José Bollo
13 </code></pre>
14
15 <a name="Foreword"></a>
16 <h2>Foreword</h2>
17
18 <p>This document describes what we intend to do. It may happen that our
19 current implementation and the content of this document differ.</p>
20
21 <p>In case of differences, it is assumed that this document is right
22 and the implementation is wrong.</p>
23
24 <a name="Introduction"></a>
25 <h2>Introduction</h2>
26
27 <p>During the first works in having the security model of Tizen
28 integrated in AGL (Automotive Grade Linux) distribution, it became
29 quickly obvious that the count of components specific to Tizen
30 to integrate was huge.</p>
31
32 <p>Here is a minimal list of what was needed:</p>
33
34 <ul>
35 <li>platform/appfw/app-installers</li>
36 <li>platform/core/security/cert-svc</li>
37 <li>platform/core/appfw/ail</li>
38 <li>platform/core/appfw/aul-1</li>
39 <li>platform/core/appfw/libslp-db-util</li>
40 <li>platform/core/appfw/pkgmgr-info</li>
41 <li>platform/core/appfw/slp-pkgmgr</li>
42 </ul>
43
44
45 <p>But this list is complete because many dependencies are hidden.
46 Those hidden dependencies are including some common libraries but also many
47 tizen specific sub-components (iniparser, bundle, dlog, libtzplatform-config,
48 db-util, vconf-buxton, &hellip;).</p>
49
50 <p>This is an issue because AGL is not expected to be Tizen. Taking it would
51 either need to patch it for removing unwanted components or to take all
52 of them.</p>
53
54 <p>However, a careful study of the core components of the security framework
55 of Tizen showed that their dependencies to Tizen are light (and since some
56 of our work, there is no more dependency to tizen).
57 Those components are <strong>cynara</strong>, <strong>security-manager</strong>, <strong>D-Bus aware of cynara</strong>.</p>
58
59 <p>Luckyly, these core security components of Tizen are provided
60 by <a href="https://github.com/01org/meta-intel-iot-security" title="A collection of layers providing security technologies">meta-intel-iot-security</a>, a set of yocto layers.
61 These layers were created by Intel to isolate Tizen specific security
62 components from the initial port of Tizen to Yocto.
63 The 3 layers are providing components for:</p>
64
65 <ul>
66 <li>Implementing Smack LSM</li>
67 <li>Implementing Integrity Measurement Architecture</li>
68 <li>Implementing Tizen Security Framework</li>
69 </ul>
70
71
72 <p>The figure below shows the history of these layers.</p>
73
74 <pre><code>                  2014         2015
75 Tizen OBS ----------+---------------------------&gt;
76                      \
77                       \
78      Tizen Yocto       +---------+--------------&gt;
79                                   \
80                                    \
81        meta-intel-iot-security      +-----------&gt;
82 </code></pre>
83
84 <p>We took the decision to use these security layers that provides the
85 basis of the Tizen security, the security framework.</p>
86
87 <p>For the components of the application framework, built top of
88 the security framework, instead of pulling the huge set of packages
89 from Tizen, we decided to refit it by developping a tiny set of
90 components that would implement the same behaviour but without all
91 the dependencies and with minor architectural improvements for AGL.</p>
92
93 <p>These components are <strong>afm-system-daemon</strong> and <strong>afm-user-daemon</strong>.
94 They provides infrastructure for installing, uninstalling,
95 launching, terminating, stopping and resuming applications in
96 a multi user secure environment.</p>
97
98 <p>A third component exists in the framework, the binder <strong>afb-daemon</strong>.
99 The binder provides the easiest way to provide secured API for
100 any tier. Currently, the use of the binder is not absolutely mandatory.</p>
101
102 <p>This documentation explains the framework created by IoT.bzh
103 by rewriting the Tizen Application Framework. Be aware of the
104 previous foreword.</p>
105
106 <a name="Overview"></a>
107 <h2>Overview</h2>
108
109 <p>The figure below shows the major components of the framework
110 and their interactions going through the following scenario:
111 APPLICATION installs an other application and then launch it.</p>
112
113 <pre><code>+-----------------------------------------------------------------------+
114 |                                 User                                  |
115 |  ................................                                     |
116 |  :   Smack isolation context    :                                     |
117 |  :                              :      ...........................    |
118 |  :  +-----------------------+   :      : Smack isolation context :    |
119 |  :  |                       |   :      :                         :    |
120 |  :  |      APPLICATION      |   :      :     OTHER application   :    |
121 |  :  |                       |   :      :.........................:    |
122 |  :  +-----------+-----------+   :                ^                    |
123 |  :              |               :                |                    |
124 |  :              |(1),(7)        :                |(13)                |
125 |  :              |               :                |                    |
126 |  :  +-----------v-----------+   :      +---------+---------------+    |
127 |  :  |   binder afb-daemon   |   :      |                         |    |
128 |  :  +-----------------------+   :      |      afm-user-daemon    |    |
129 |  :  |    afm-main-plugin    |   :      |                         |    |
130 |  :  +-----+--------------+--+   :      +------^-------+------+---+    |
131 |  :........|..............|......:             |       |      :        |
132 |           |(2)           |(8)                 |(10)   |      :        |
133 |           |              |                    |       |      :        |
134 |           |         +----v--------------------+---+   |      :        |
135 |           |         |        D-Bus   session      |   |(11)  :(12)    |
136 |           |         +-------------------------+---+   |      :        |
137 |           |                                   |       |      :        |
138 |           |                                   |(9)    |      :        |
139 |           |                                   |       |      :        |
140 :===========|===================================|=======|======:========:
141 |           |                                   |       |      :        |
142 |           |                               +---v-------v--+   :        |
143 |    +------v-------------+     (3)         |              |   :        |
144 |    |  D-Bus   system    +-----------------&gt;    CYNARA    |   :        |
145 |    +------+-------------+                 |              |   :        |
146 |           |                               +------^-------+   :        |
147 |           |(4)                                   |           :        |
148 |           |                                      |(6)        v        |
149 |    +------v--------------+             +---------+---------------+    |
150 |    |                     |    (5)      |                         |    |
151 |    |  afm-system-daemon  +-------------&gt;     SECURITY-MANAGER    |    |
152 |    |                     |             |                         |    |
153 |    +---------------------+             +-------------------------+    |
154 |                                                                       |
155 |                              System                                   |
156 +-----------------------------------------------------------------------+
157 </code></pre>
158
159 <p>Let follow the sequence of calls:</p>
160
161 <ol>
162 <li><p>APPLICATION calls its <strong>binder</strong> to install the OTHER application.</p></li>
163 <li><p>The plugin <strong>afm-main-plugin</strong> of the <strong>binder</strong> calls, through
164 <strong>D-Bus</strong> system, the system daemon to install the OTHER application.</p></li>
165 <li><p>The system <strong>D-Bus</strong> checks wether APPLICATION has the permission
166 or not to install applications by calling <strong>CYNARA</strong>.</p></li>
167 <li><p>The system <strong>D-Bus</strong> transmits the request to <strong>afm-system-daemon</strong>.</p>
168
169 <p><strong>afm-system-daemon</strong> checks the application to install, its
170 signatures and rights and install it.</p></li>
171 <li><p><strong>afm-system-daemon</strong> calls <strong>SECURITY-MANAGER</strong> for fullfilling
172 security context of the installed application.</p></li>
173 <li><p><strong>SECURITY-MANAGER</strong> calls <strong>CYNARA</strong> to install initial permissions
174 for the application.</p></li>
175 <li><p>APPLICATION call its binder to start the nearly installed OTHER application.</p></li>
176 <li><p>The plugin <strong>afm-main-plugin</strong> of the <strong>binder</strong> calls, through
177 <strong>D-Bus</strong> session, the user daemon to launch the OTHER application.</p></li>
178 <li><p>The session <strong>D-Bus</strong> checks wether APPLICATION has the permission
179 or not to start an application by calling <strong>CYNARA</strong>.</p></li>
180 <li><p>The session <strong>D-Bus</strong> transmits the request to <strong>afm-user-daemon</strong>.</p></li>
181 <li><p><strong>afm-user-daemon</strong> checks wether APPLICATION has the permission
182 or not to start the OTHER application <strong>CYNARA</strong>.</p></li>
183 <li><p><strong>afm-user-daemon</strong> uses <strong>SECURITY-MANAGER</strong> features to set
184 the seciruty context for the OTHER application.</p></li>
185 <li><p><strong>afm-user-daemon</strong> launches the OTHER application.</p></li>
186 </ol>
187
188
189 <p>This scenario does not cover all the features of the frameworks.
190 Shortly because details will be revealed in the next chapters,
191 the components are:</p>
192
193 <ul>
194 <li><p><strong><em>SECURITY-MANAGER</em></strong>: in charge of setting Smack contexts and rules,
195 of setting groups, and, of creating initial content of <em>CYNARA</em> rules
196 for applications.</p></li>
197 <li><p><strong><em>CYNARA</em></strong>: in charge of handling API access permissions by users and by
198 applications.</p></li>
199 <li><p><strong><em>D-Bus</em></strong>: in charge of checking security of messaging. The usual D-Bus
200 security rules are enhanced by <em>CYNARA</em> checking rules.</p></li>
201 <li><p><strong><em>afm-system-daemon</em></strong>: in charge of installing and uninstalling applications.</p></li>
202 <li><p><strong><em>afm-user-daemon</em></strong>: in charge of listing applications, querying application details,
203 starting, terminating, stopping, resuming applications and their instances
204 for a given user context.</p></li>
205 <li><p><strong><em>afb-binder</em></strong>: in charge of serving resources and features through an
206 HTTP interface.</p></li>
207 <li><p><strong><em>afm-main-plugin</em></strong>: This plugin allows applications to use the API
208 of the AGL framework.</p></li>
209 </ul>
210
211
212 <a name="Links.between.the..Security.framework..and.the..Application.framework."></a>
213 <h2>Links between the &ldquo;Security framework&rdquo; and the &ldquo;Application framework&rdquo;</h2>
214
215 <p>The security framework refers to the security model used to ensure
216 security and to the tools that are provided for implementing that model.</p>
217
218 <p>The security model refers to how DAC (Discretionnary Access Control),
219 MAC (Mandatory Access Control) and Capabilities are used by the system
220 to ensure security and privacy. It also includes features of reporting
221 using audit features and by managing logs and alerts.</p>
222
223 <p>The application framework manages the applications:
224 installing, uninstalling, starting, stopping, listing &hellip;</p>
225
226 <p>The application framework uses the security model/framework
227 to ensure the security and the privacy of the applications that
228 it manages.</p>
229
230 <p>The application framework must be compliant with the underlyiong
231 security model/framework. But it should hide it to the applications.</p>
232
233 <a name="The.security.framework"></a>
234 <h2>The security framework</h2>
235
236 <p>The implemented security model is the security model of Tizen 3.
237 This model is described <a href="https://wiki.tizen.org/wiki/Security/Tizen_3.X_Overview" title="Tizen 3 security overview">here</a>.</p>
238
239 <p>The security framework then comes from Tizen 3 but through
240 the <a href="https://github.com/01org/meta-intel-iot-security" title="A collection of layers providing security technologies">meta-intel</a>.
241 It includes: <strong>Security-Manager</strong>, <strong>Cynara</strong>
242 and <strong>D-Bus</strong> compliant to Cynara.</p>
243
244 <p>Two patches are applied to the security-manager. These patches are removing
245 dependencies to packages specific of Tizen but that are not needed by AGL.
246 None of these patches adds or removes any behaviour.</p>
247
248 <p><strong>Theoritically, the security framework/model is an implementation details
249 that should not impact the layers above the application framework</strong>.</p>
250
251 <p>The security framework of Tizen provides &ldquo;nice lad&rdquo; a valuable component to
252 scan log files and analyse auditing. This component is still in developement.</p>
253
254 <a name="The.application.framework"></a>
255 <h2>The application framework</h2>
256
257 <p>The application framework on top of the security framework
258 provides the components to install and uninstall applications
259 and to run it in a secured environment.</p>
260
261 <p>The goal is to manage applications and to hide the details of
262 the security framework to the applications.</p>
263
264 <p>For the reasons explained in introduction, we did not used the
265 application framework of Tizen as is but used an adaptation of it.</p>
266
267 <p>The basis is kept identical: the applications are distributed
268 in a digitally signed container that must match the specifications
269 of widgets (web applications). This is described by the technical
270 recomendations <a href="http://www.w3.org/TR/widgets" title="Packaged Web Apps">widgets</a> and <a href="http://www.w3.org/TR/widgets-digsig" title="XML Digital Signatures for Widgets">widgets-digsig</a> of the W3 consortium.</p>
271
272 <p>This model allows the distribution of HTML, QML and binary applications.</p>
273
274 <p>The management of signatures of the widget packages
275 This basis is not meant as being rigid and it can be extended in the
276 futur to include for example incremental delivery.</p>
277 </body>
278 </html>