summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 6054267bdfa2956b7ac8220d8249270ebac76f34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Ope
# afm-main

## Overview

This repository is named **afm-main** because
it stands for **AGL Framework Master - Main**.

It contains programs and services to create widgets,
to install widgets, to run widgets.

## How to compile?

This project uses CMAKE and C compiler suite to be compiled.

### Dependencies

This package requires the following libraries or modules:

- ***libxml-2.0***
- ***openssl***
- ***xmlsec1***
- ***xmlsec1-openssl***
- ***json-c***
- ***dbus-1***
- ***security-manager***

This package also requires either ***libzip*** (version >= 0.11) 
or the binaries ***zip*** and ***unzip***. By default, it will
use ***libzip***.

### Compiling

The main scheme for compiling the project is:

> cmake .
> 
> make
> 
> sudo make install

By default, the installation is made in ***/usr***.
To change this behaviour, you should set the variable
CMAKE_INSTALL_PREFIX as in the below example:

> cmake -DCMAKE_INSTALL_PREFIX=/some/where .

You could check the documentation of the standard CMake module 
[GNUInstallDirs](https://cmake.org/cmake/help/v3.4/module/GNUInstallDirs.html).

To forbid the use of ***libzip*** and replace it with the
use of programs ***zip*** and ***unzip***, type:

> cmake -DUSE_LIBZIP=0 .

### Evaluation on AGL using yocto

TO BE CONTINUED

## Content

This package content source files for several programs.
The installed programs are:

- ***afm-system-daemon***: D-Bus daemon to install,
  uninstall, list the widgets.

  It runs on the system bus.

- ***afm-user-daemon***: D-Bus daemon to list
  available widgets, to start, pause, resume, stop it.

  It runs on the user session bus.

- ***wgtpkg-info***: command line tool to display
  informations about a widget file.

- ***wgtpkg-installer***: command line tool to
  install a widget file.

- ***wgtpkg-pack***: command line tool to create
  a widget file from a widget directory.

- ***wgtpkg-sign***: command line tool to add a signature
  to a widget directory.

## Description

### Actors

The framework defined by afm-main is defining several actors:
the platform designer, the application developper, the distributor,
the user, the hacker.

The platform designer defines the AGL system and its security.

The application developer in link or not with hardware vendors
is creating applications, modules, libraries, services that will
be installed to the platform.

The hacker is a user that also develops application for
tuning its system.

The distributor is the mediator between the developer and the
user. It provides 

The user is either the driver or a passenger of the car.

The application, libraries, services are available on the
platform. Somme of it are in direct interaction with users.
Some others, like services, are used indirectly.


### Scenarii

#### Writing applications

The application will receive an identifier.
That identifier must be must have the following feature:

- it must be unic to identify the application and its revisions
- it should be short enough to be used with efficiency by
  security components of the system
- it can not be stolen by malicious applications that
  would like to usurpate the application identity
- it can be sold to other company

The framework provide a facility to create an asymetric
key that will serve all the above purposes (it currently
doen't).

Using its favorite environment, the developper
produce applications for the target.

Depending on its constraints either economic,
technical or human, the developer choose the language
and the environment for developing the applications.

This step needs to test and to debug the application on
a target or on a simulator of the target.
In both cases, the code should be lively inspected and
changed, as well as the permissions and the security
aspects.

The framework will provide facilities for debugging
(it currently doesn't).

#### Packaging applications

Currently the frame work expect widgets packaged as
specified by [Packaged Web Apps](http://www.w3.org/TR/widgets).

When the application is ready, the developper
creates a package for it. The creation of the package
is made of few steps:

- isolate the strict necessarily files and structure it 
  to be children of only one root directory
- sign the application with the developper key
- sign the application with its application key
- pack the application using zip

The framework will provide facilities to package applications.

Parts of the job can be made with tools provided by afm-main:

- ***wgtpkg-sign*** is used to add signatures at root of the package
- ***wgtpkg-pack*** is used to create the package file (with wgt extension).

Currently, the ***config.xml*** file must be edited by hand.
See below [Writing the config.xml](#writing-config).

#### Distributing applications

Normally a store will distribute the application.
It will be the normal process. The distributor adds
a signature to the distributed application.

The added signature can allow more or less permission to
applications. For example, a critical application nested
in the system should have high level permissions allowing
it to do things that should normally not be done (changing
system configuration for example).
To allow such an application, the distributor must sign
it using its secret private key that will unlock the
requested level of permissions.

Currently, the frammework allows to make these steps by hand
the programs ***unzip***, ***wgtpkg-sign*** and ***wgtpkg-pack***.

The applications of the store will then be available
for browsing and searching over HTTP/Internet.

#### Installing applications

The framework will provide an API for downloading and
installing an application from stores (it currently doesn't).

The current version of afm allows to install widgets
from local files (either preinstalled or downloaded).

To install a widget, you can use either the program
***wgtpkg-installer*** while being the framework user.

TO BE CONTINUED

#### Launching application

TO BE CONTINUED


## Writing the config.xml <a id="writing-config"/>

TO BE CONTINUED

For permissions: ***urn:agl:perm:...***

For plugins: ***urn:agl:plugin:...***


## Cryptography

The widgets are currently signed and checked using the library
[XMLSec](https://www.aleksey.com/xmlsec).

The current state isn't providing our keys.
Will be done soon.

TO BE CONTINUED

## Extension to the packaging specifications

The widgets are specified in that W3C recommandation: 
[Packaged Web Apps](http://www.w3.org/TR/widgets).
This model was initially designed for HTML applications.
But it is well suited for other kind of applications.

It relies on this specification that is the master
piece of interest and the most useful part:
[XML Digital Signatures for Widgets](http://www.w3.org/TR/widgets-digsig).

An other specification exist that isn't either mature
nor suited for managing privileges:
[Web App Manifest](http://www.w3.org/TR/appmanifest).
However, it may become of actuallity in some future.

The main idea is to use the file ***config.xml*** as a switch
for several contants.
The current specifications for ***config.xml*** are allowing
to describe either HTML5, QML and native applications.
Using *feature*, it is also possible to define uses of
libraries.

For more advanced uses like:

- incremental updates
- multiple application packages
- system updates

The file ***config.xml*** may:

- either, contain a root different that *widget*
- or, not exist, being replaced with something else.

## Comparison with Tizen framework

This package is providing few less behaviour than
the following Tizen packages:

- platform/appfw/app-installers
- platform/core/security/cert-svc
- platform/core/appfw/ail
- platform/core/appfw/aul-1
- platform/core/appfw/libslp-db-util
- platform/core/appfw/pkgmgr-info
- platform/core/appfw/slp-pkgmgr



## Links

- [Packaged Web Apps](http://www.w3.org/TR/widgets)
- [XML Digital Signatures for Widgets](http://www.w3.org/TR/widgets-digsig)
- [libxml2](http://xmlsoft.org/html/index.html)
- [OpenSSL](https://www.openssl.org)
- [XMLSec](https://www.aleksey.com/xmlsec)
- [JSON-c](https://github.com/json-c/json-c)
- [D-Bus](http://www.freedesktop.org/wiki/Software/dbus)
- [libzip](http://www.nih.at/libzip)
- [CMake](https://cmake.org)
- [Security-Manager](https://wiki.tizen.org/wiki/Security/Tizen_3.X_Security_Manager)
- [Web App Manifest](http://www.w3.org/TR/appmanifest)