From bad30c92a1cbe0e411f52c277cef37b6570b623f Mon Sep 17 00:00:00 2001 From: José Bollo Date: Fri, 24 Jun 2016 15:44:24 +0200 Subject: improves the documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ieea284220b2b088bf460093f745e8f5fb3633eca Signed-off-by: José Bollo --- doc/afm-system-daemon.html | 260 ++++-------- doc/afm-user-daemon.html | 890 ++++++++++++++--------------------------- doc/application-framework.html | 181 +++------ doc/overview.html | 306 +++++--------- doc/quick-tutorial.html | 275 ++++--------- doc/security-framework.html | 59 +-- doc/updt.sh | 65 +-- doc/widgets.html | 217 ++++++---- doc/widgets.md | 165 +++++++- 9 files changed, 955 insertions(+), 1463 deletions(-) (limited to 'doc') diff --git a/doc/afm-system-daemon.html b/doc/afm-system-daemon.html index 4569bc2..436a985 100644 --- a/doc/afm-system-daemon.html +++ b/doc/afm-system-daemon.html @@ -1,63 +1,53 @@ + - - + + + + + + The afm-system-daemon + + + - -

The afm-system-daemon

- +
+

The afm-system-daemon

+

José Bollo

+

Fulup Ar Foll

+

30 mai 2016

+
+ +

The afm-system-daemon

version: 1
 Date:    30 mai 2016
-Author:  José Bollo
-
- -

- - -

Foreword

- -

This document describes application framework system daemon fundamentals. -FCF (Fully Conform to Specification) implementation is still under development. -It may happen that current implementation somehow diverges with specifications.

- - -

Introduction

- -

The daemon afm-system-daemon is in charge of installing -applications on AGL system. Its main tasks are:

- +Author: José Bollo +

TABLE-OF-CONTENT-HERE

+

Foreword

+

This document describes application framework system daemon fundamentals. FCF (Fully Conform to Specification) implementation is still under development. It may happen that current implementation somehow diverges with specifications.

+

Introduction

+

The daemon afm-system-daemon is in charge of installing applications on AGL system. Its main tasks are:

- - -

The afm-system-daemon takes its orders from system -instance of D-Bus.

- +

The afm-system-daemon takes its orders from system instance of D-Bus.

The figure below summarizes the situation of afm-system-daemon in the system.

-
+------------------------------------------------------------+
 |                          User                              |
 |                                                            |
@@ -79,169 +69,89 @@ instance of D-Bus.

| +--------------------+ +-----------------------+ | | | | System | -+------------------------------------------------------------+ -
- - -

Starting afm-system-daemon

- -

afm-system-daemon is launched as a systemd service -attached to system. Normally, the service file is -located at /lib/systemd/system/afm-system-daemon.service.

- ++------------------------------------------------------------+ +

Starting afm-system-daemon

+

afm-system-daemon is launched as a systemd service attached to system. Normally, the service file is located at /lib/systemd/system/afm-system-daemon.service.

The options for launching afm-system-daemon are:

-
-r
 --root directory
 
- Set the root application directory.
+     Set the root application directory.
 
- Note that the default root directory is defined
- to be /usr/share/afm/applications (may change).
+     Note that the default root directory is defined
+     to be /usr/share/afm/applications (may change).
 
 -d
 --daemon
 
- Daemonizes the process. It is not needed by sytemd.
+     Daemonizes the process. It is not needed by sytemd.
 
 -q
 --quiet
 
- Reduces the verbosity (can be repeated).
+     Reduces the verbosity (can be repeated).
 
 -v
 --verbose
 
- Increases the verbosity (can be repeated).
+     Increases the verbosity (can be repeated).
 
 -h
 --help
 
- Prints a short help.
-
- - -

The D-Bus interface

- - -

Overview of the dbus interface

- -

afm-system-daemon takes its orders from the session instance -of D-Bus. The use of D-Bus is great because it allows to implement -discovery and signaling.

- -

The afm-system-daemon is listening with the destination name -org.AGL.afm.system at the object of path /org/AGL/afm/system -on the interface org.AGL.afm.system for the below detailed -members install and uninstall.

- -

D-Bus is mainly used for signaling and discovery. Its optimized -typed protocol is not used except for transmitting only one string -in both directions.

- -

The client and the service are using JSON serialization to -exchange data.

- + Prints a short help. +

The D-Bus interface

+

Overview of the dbus interface

+

afm-system-daemon takes its orders from the session instance of D-Bus. The use of D-Bus is great because it allows to implement discovery and signaling.

+

The afm-system-daemon is listening with the destination name org.AGL.afm.system at the object of path /org/AGL/afm/system on the interface org.AGL.afm.system for the below detailed members install and uninstall.

+

D-Bus is mainly used for signaling and discovery. Its optimized typed protocol is not used except for transmitting only one string in both directions.

+

The client and the service are using JSON serialization to exchange data.

The D-Bus interface is defined by:

- - - -

The signature of any member of the interface is string -> string -for JSON -> JSON.

- -

This is the normal case. In case of error, the current implementation -returns a dbus error that is a string.

- -

Here is an example using dbus-send to query data on -installed applications.

- +

The signature of any member of the interface is string -> string for JSON -> JSON.

+

This is the normal case. In case of error, the current implementation returns a dbus error that is a string.

+

Here is an example using dbus-send to query data on installed applications.

dbus-send --session --print-reply \
---dest=org.AGL.afm.system \
-/org/AGL/afm/system \
-org.AGL.afm.system.install 'string:"/tmp/appli.wgt"'
-
- - -

The protocol over D-Bus

- + --dest=org.AGL.afm.system \ + /org/AGL/afm/system \ + org.AGL.afm.system.install 'string:"/tmp/appli.wgt"' +

The protocol over D-Bus


- - -

Method org.AGL.afm.system.install

- +

Method org.AGL.afm.system.install

Description: Install an application from a widget file.

- -

When an application with the same id and version already exists. Outside of -using force=true the application is not reinstalled.

- -

Applications are installed the subdirectories of applications common directory. -If root is specified, the application is installed under the -sub-directories of the root defined.

- -

Note that this methods is a simple accessor method of -org.AGL.afm.system.install from afm-system-daemon.

- -

After the installation and before returning to the sender, -afm-system-daemon sends a signal org.AGL.afm.system.changed.

- -

Input: The path of the widget file to install and, optionally, -a flag to force reinstallation, and, optionally, a root directory.

- +

When an application with the same id and version already exists. Outside of using force=true the application is not reinstalled.

+

Applications are installed the subdirectories of applications common directory. If root is specified, the application is installed under the sub-directories of the root defined.

+

Note that this methods is a simple accessor method of org.AGL.afm.system.install from afm-system-daemon.

+

After the installation and before returning to the sender, afm-system-daemon sends a signal org.AGL.afm.system.changed.

+

Input: The path of the widget file to install and, optionally, a flag to force reinstallation, and, optionally, a root directory.

Either just a string being the absolute path of the widget file:

- -
"/a/path/driving/to/the/widget"
-
- +
"/a/path/driving/to/the/widget"

Or an object:

-
{
-  "wgt": "/a/path/to/the/widget",
-  "force": false,
-  "root": "/a/path/to/the/root"
-}
-
- -

“wgt” and “root” must be absolute paths.

- -

output: An object with the field “added” being the string for -the id of the added application.

- -
{"added":"appli@x.y"}
-
- + "wgt": "/a/path/to/the/widget", + "force": false, + "root": "/a/path/to/the/root" +} +

"wgt" and "root" must be absolute paths.

+

output: An object with the field "added" being the string for the id of the added application.

+
{"added":"appli@x.y"}

- - -

Method org.AGL.afm.system.uninstall

- +

Method org.AGL.afm.system.uninstall

Description: Uninstall an application from its id.

- -

Note that this methods is a simple method accessor of -org.AGL.afm.system.uninstall from afm-system-daemon.

- -

After the uninstallation and before returning to the sender, -afm-system-daemon sends a signal org.AGL.afm.system.changed.

- +

Note that this methods is a simple method accessor of org.AGL.afm.system.uninstall from afm-system-daemon.

+

After the uninstallation and before returning to the sender, afm-system-daemon sends a signal org.AGL.afm.system.changed.

Input: the id of the application and optionally the application root path.

-

Either a string:

- -
"appli@x.y"
-
- +
"appli@x.y"

Or an object:

-
{
-  "id": "appli@x.y",
-  "root": "/a/path/to/the/root"
-}
-
- -

output: the value ‘true’.

+ "id": "appli@x.y", + "root": "/a/path/to/the/root" +} +

output: the value 'true'.

diff --git a/doc/afm-user-daemon.html b/doc/afm-user-daemon.html index d69c396..a7fcd49 100644 --- a/doc/afm-user-daemon.html +++ b/doc/afm-user-daemon.html @@ -1,94 +1,68 @@ + - - + + + + + + The afm-user-daemon + + + - -

The afm-user-daemon

- +
+

The afm-user-daemon

+

José Bollo

+

Fulup Ar Foll

+

30 mai 2016

+
+ +

The afm-user-daemon

version: 1
 Date:    30 mai 2016
-Author:  José Bollo
-
- -

- - -

Foreword

- -

This document describes application framework user daemon fundamentals. -FCF (Fully Conform to Specification) implementation is still under development. -It may happen that current implementation somehow diverges with specifications.

- - -

Introduction

- -

The daemon afm-user-daemon is in charge of handling -applications on behalf of a user. Its main tasks are:

- +Author: José Bollo +

TABLE-OF-CONTENT-HERE

+

Foreword

+

This document describes application framework user daemon fundamentals. FCF (Fully Conform to Specification) implementation is still under development. It may happen that current implementation somehow diverges with specifications.

+

Introduction

+

The daemon afm-user-daemon is in charge of handling applications on behalf of a user. Its main tasks are:

- - -

The afm-user-daemon takes its orders from the session -instance of D-Bus.

- +

The afm-user-daemon takes its orders from the session instance of D-Bus.

The figure below summarizes the situation of afm-user-daemon in the system.

-
+------------------------------------------------------------+
 |                          User                              |
 |                                 +---------------------+    |
@@ -115,165 +89,89 @@ instance of D-Bus.

| +--------------------+ +-----------------------+ | | | | System | -+------------------------------------------------------------+ -
- - -

Tasks of afm-user-daemon

- - -

Maintaining list of applications

- -

At start afm-user-daemon scans the directories containing -applications and load in memory a list of avaliable applications -accessible by current user.

- -

When afm-system-daemon installs or removes an application. -On success it sends the signal org.AGL.afm.system.changed. -When receiving such a signal, afm-user-daemon rebuilds its -applications list.

- -

afm-user-daemon provides the data it collects about -applications to its clients. Clients may either request the full list -of avaliable applications or a more specific information about a -given application.

- - -

Launching application

- -

afm-user-daemon launches application. Its builds a secure -environment for the application before starting it within a -secured environment.

- ++------------------------------------------------------------+ +

Tasks of afm-user-daemon

+

Maintaining list of applications

+

At start afm-user-daemon scans the directories containing applications and load in memory a list of avaliable applications accessible by current user.

+

When afm-system-daemon installs or removes an application. On success it sends the signal org.AGL.afm.system.changed. When receiving such a signal, afm-user-daemon rebuilds its applications list.

+

afm-user-daemon provides the data it collects about applications to its clients. Clients may either request the full list of avaliable applications or a more specific information about a given application.

+

Launching application

+

afm-user-daemon launches application. Its builds a secure environment for the application before starting it within a secured environment.

Different kind of applications can be launched.

- -

This is set using a configuration file that describes -how to launch an application of a given kind within a given -mode.

- +

This is set using a configuration file that describes how to launch an application of a given kind within a given mode.

There is two launching modes: local or remote.

- -

Launching an application locally means that -the application and its binder are launched together.

- -

Launching application remotely translates in only launching -the application binder. The UI by itself has to be activated -remotely by the requested (ie: HTML5 homescreen in a browser)

- -

Once launched, running instances of application receive -a runid that identify them.

- - -

Managing instances of running applications

- -

afm-user-daemon manages the list of applications -that it launched.

- -

When owning the right permissions, a client can get the list -of running instances and details about a specific -running instance. It can also terminates, stops or -continues a given application.

- - -

Installing and uninstalling applications

- -

If the client own the right permissions, -afm-user-daemon delegates that task -to afm-system-daemon.

- - -

Starting afm-user-daemon

- -

afm-user-daemon is launched as a systemd service -attached to user sessions. Normally, the service file is -located at /usr/lib/systemd/user/afm-user-daemon.service.

- +

Launching an application locally means that the application and its binder are launched together.

+

Launching application remotely translates in only launching the application binder. The UI by itself has to be activated remotely by the requested (ie: HTML5 homescreen in a browser)

+

Once launched, running instances of application receive a runid that identify them.

+

Managing instances of running applications

+

afm-user-daemon manages the list of applications that it launched.

+

When owning the right permissions, a client can get the list of running instances and details about a specific running instance. It can also terminates, stops or continues a given application.

+

Installing and uninstalling applications

+

If the client own the right permissions, afm-user-daemon delegates that task to afm-system-daemon.

+

Starting afm-user-daemon

+

afm-user-daemon is launched as a systemd service attached to user sessions. Normally, the service file is located at /usr/lib/systemd/user/afm-user-daemon.service.

The options for launching afm-user-daemon are:

-
-a
 --application directory
 
- Includes the given application directory to
- the database base of applications.
+     Includes the given application directory to
+     the database base of applications.
 
- Can be repeated.
+     Can be repeated.
 
 -r
 --root directory 
 
- Includes root application directory or directories when
- passing multiple rootdir to
- applications database.
-
- Note that default root directory for
- applications is always added. In current version
- /usr/share/afm/applications is used as default.
+     Includes root application directory or directories when
+     passing multiple rootdir to
+     applications database.
 
+     Note that default root directory for
+     applications is always added. In current version
+     /usr/share/afm/applications is used as default.
+    
 -m
 --mode (local|remote)
 
- Set the default launch mode.
- The default value is 'local'
+     Set the default launch mode.
+     The default value is 'local'
 
 -d
 --daemon
 
- Daemonizes the process. It is not needed by sytemd.
+     Daemonizes the process. It is not needed by sytemd.
 
 -q
 --quiet
 
- Reduces the verbosity (can be repeated).
+     Reduces the verbosity (can be repeated).
 
 -v
 --verbose
 
- Increases the verbosity (can be repeated).
+     Increases the verbosity (can be repeated).
 
 -h
 --help
 
- Prints a short help.
-
- - -

Launcher Configuration

- -

It contains rules for launching applications. -When afm-user-daemon has to launch an application, -it looks for launch mode (local or remote), as well as -for the type of application describe in config.xml -widget configuration file.

- + Prints a short help. +

Launcher Configuration

+

It contains rules for launching applications. When afm-user-daemon has to launch an application, it looks for launch mode (local or remote), as well as for the type of application describe in config.xml widget configuration file.

This tuple mode+type allows to select the adequate rule.

-

Configuration file is /etc/afm/afm-launch.conf.

- -

It contains sections and rules. It can also contain comments -and empty lines to improve readability.

- -

The separators are space and tabulation, any other character -should have a meaning.

- -

The format is line oriented. -The new line character separate the lines.

- -

Lines having only separators are blank lines and ignored. -Line having character #(sharp) at first position are comment -lines and ignored.

- -

Lines not starting with a separator are different -from lines starting with a separator character.

- +

It contains sections and rules. It can also contain comments and empty lines to improve readability.

+

The separators are space and tabulation, any other character should have a meaning.

+

The format is line oriented. The new line character separate the lines.

+

Lines having only separators are blank lines and ignored. Line having character #(sharp) at first position are comment lines and ignored.

+

Lines not starting with a separator are different from lines starting with a separator character.

The grammar of the configuration file is defined below:

-
CONF: *COMMENT *SECTION
 
 SECTION: MODE *RULE
 
 RULE: +TYPE VECTOR ?VECTOR
 
-MODE: 'mode' +SEP ('local' | 'remote') *SEP EOL
+MODE: 'mode' +SEP ('local' | 'remote') *SEP EOL
 
 TYPE: DATA *SEP EOL
 
@@ -285,30 +183,22 @@ NDATA: +NCHAR
 EOL: NL *COMMENT
 COMMENT: *SEP CMT *(SEP | NCHAR) NL
 
-NL: '\x0a'
-SEP: '\x20' | '\x09'
-CMT: '#'
-CHAR: '\x00'..'\x08' | '\x0b'..'\x1f' | '\x21' | '\x22' | '\x24'..'\xff'
-NCHAR: CMT | CHAR
-
- -

Here is a sample of configuration file for defining how -to launch an application of types application/x-executable, -text/x-shellscript and text/html in local mode:

- +NL: '\x0a' +SEP: '\x20' | '\x09' +CMT: '#' +CHAR: '\x00'..'\x08' | '\x0b'..'\x1f' | '\x21' | '\x22' | '\x24'..'\xff' +NCHAR: CMT | CHAR +

Here is a sample of configuration file for defining how to launch an application of types application/x-executable, text/x-shellscript and text/html in local mode:

mode local
 
 application/x-executable
 text/x-shellscript
-%r/%c
+    %r/%c
 
 text/html
-/usr/bin/afb-daemon --mode=local --readyfd=%R --alias=/icons:%I --port=%P --rootdir=%r --token=%S --sessiondir=%D/.afb-daemon
-/usr/bin/web-runtime http://localhost:%P/%c?token=%S
-
- + /usr/bin/afb-daemon --mode=local --readyfd=%R --alias=/icons:%I --port=%P --rootdir=%r --token=%S --sessiondir=%D/.afb-daemon + /usr/bin/web-runtime http://localhost:%P/%c?token=%S

This shows that:

- - - - -

mode local

- -

Within this mode, the launchers have either one or two description vectors. -All of those vectors are treated as programs -and are executed with ‘execve’ system call.

- -

The first vector is the leader vector and it defines the process -group. The second vector (if any) is attached to the group -defined by this first vector.

- - -

mode remote

- -

Within this mode, the launchers have either one or two vectors -describing them.

- -

The first vector is process as a program and is executed with -system call ‘execve’.

- -

The second vector (if any) defines a text that is returned -to the caller. This mechanism can be used to return a uri -for remote UI to connect on the newly launched application.

- -

The daemon afm-user-daemon allocates a port for each -new remote application. -The current implementation port allocation is incremental. -A smarter (cacheable and discoverable) allocation should be defined.

- - -

%substitutions

- -

Vectors can include sequences of 2 characters that have a special -meaning. These sequences are named %substitution because their -first character is the percent sign (%) and because each occurrence -of the sequence is replaced, at launch time, by the value associated -to sequences.

- +

mode local

+

Within this mode, the launchers have either one or two description vectors. All of those vectors are treated as programs and are executed with 'execve' system call.

+

The first vector is the leader vector and it defines the process group. The second vector (if any) is attached to the group defined by this first vector.

+

mode remote

+

Within this mode, the launchers have either one or two vectors describing them.

+

The first vector is process as a program and is executed with system call 'execve'.

+

The second vector (if any) defines a text that is returned to the caller. This mechanism can be used to return a uri for remote UI to connect on the newly launched application.

+

The daemon afm-user-daemon allocates a port for each new remote application. The current implementation port allocation is incremental. A smarter (cacheable and discoverable) allocation should be defined.

+

%substitutions

+

Vectors can include sequences of 2 characters that have a special meaning. These sequences are named %substitution because their first character is the percent sign (%) and because each occurrence of the sequence is replaced, at launch time, by the value associated to sequences.

Here is the list of %substitutions:

- +

This simply emits the percent sign %

+

Holds application Id of launched application.

- -

Defined by the attribute id of the element -of config.xml.

-
  • %c: content

    - +

    Defined by the attribute id of the element of config.xml.

    +
      +
    • %c: content
    • +

    The file within the widget directory that is the entry point.

    - -

    For HTML applications, it represents the relative path to main -page (aka index.html).

    - -

    Defined by attribute src of the element within config.xml.

  • -
  • %D: datadir

    - -

    Path of the directory where the application runs (cwd) -and stores its data.

    - -

    It is equal to %h/%a.

  • -
  • %H: height

    - +

    For HTML applications, it represents the relative path to main page (aka index.html).

    +

    Defined by attribute src of the element within config.xml.

    +
      +
    • %D: datadir
    • +
    +

    Path of the directory where the application runs (cwd) and stores its data.

    +

    It is equal to %h/%a.

    +
      +
    • %H: height
    • +

    Requested height for the widget.

    - -

    Defined by the attribute height of the element -of config.xml.

  • -
  • %h: homedir

    - +

    Defined by the attribute height of the element of config.xml.

    +
      +
    • %h: homedir
    • +

    Path of the home directory for all applications.

    - -

    It is generally equal to $HOME/app-data

  • -
  • %I: icondir

    - -

    Path of the directory were the icons of the applications can be found.

  • -
  • %m: mime-type

    - +

    It is generally equal to $HOME/app-data

    +
      +
    • %I: icondir
    • +
    +

    Path of the directory were the icons of the applications can be found.

    +
      +
    • %m: mime-type
    • +

    Mime type of the launched application.

    - -

    Defined by the attribute type of the element -of config.xml.

  • -
  • %n: name

    - -

    Name of the application as defined by the content of the -element of config.xml.

  • -
  • %p: plugins

    - -

    In the future should represent the list of plugins and plugins directory separated by ‘,’. -Warning: not supported in current version.

  • -
  • %P: port

    - -

    A port to use. It is currently a kind of random port. The precise -model is to be defined later.

  • -
  • %R: readyfd

    - -

    Number of file descriptor to use for signaling -readiness of launched process.

  • -
  • %r: rootdir

    - -

    Path of directory containing the widget and its data.

  • -
  • %S: secret

    - -

    An hexadecimal number that can be used to initialize pairing of client -and application binder.

  • -
  • %W: width

    - -

    Requested width for the widget.

    - -

    Defined by the attribute width of the element -of config.xml.

  • +

    Defined by the attribute type of the element of config.xml.

    + - - - -

    The D-Bus interface

    - - -

    Overview of the dbus interface

    - -

    afm-user-daemon takes its orders from the session instance -of D-Bus. D-Bus is nice to use in this context because it allows -discovery and signaling.

    - -

    The dbus session is by default addressed by environment -variable DBUS_SESSION_BUS_ADDRESS. Using systemd -variable DBUS_SESSION_BUS_ADDRESS is automatically set for -user sessions.

    - -

    The afm-user-daemon is listening on destination name -org.AGL.afm.user at object path /org/AGL/afm/user -on interface org.AGL.afm.user for following members: - runnables, detail, start, terminate, -stop, continue, runners, state, -install and uninstall.

    - -

    D-Bus is mainly used for signaling and discovery. Its optimized -typed protocol is not used except for transmission of standalone strings.

    - +

    Name of the application as defined by the content of the element of config.xml.

    + +

    In the future should represent the list of plugins and plugins directory separated by ','. Warning: not supported in current version.

    + +

    A port to use. It is currently a kind of random port. The precise model is to be defined later.

    + +

    Number of file descriptor to use for signaling readiness of launched process.

    + +

    Path of directory containing the widget and its data.

    + +

    An hexadecimal number that can be used to initialize pairing of client and application binder.

    + +

    Requested width for the widget.

    +

    Defined by the attribute width of the element of config.xml.

    +

    The D-Bus interface

    +

    Overview of the dbus interface

    +

    afm-user-daemon takes its orders from the session instance of D-Bus. D-Bus is nice to use in this context because it allows discovery and signaling.

    +

    The dbus session is by default addressed by environment variable DBUS_SESSION_BUS_ADDRESS. Using systemd variable DBUS_SESSION_BUS_ADDRESS is automatically set for user sessions.

    +

    The afm-user-daemon is listening on destination name org.AGL.afm.user at object path /org/AGL/afm/user on interface org.AGL.afm.user for following members: runnables, detail, start, terminate, stop, continue, runners, state, install and uninstall.

    +

    D-Bus is mainly used for signaling and discovery. Its optimized typed protocol is not used except for transmission of standalone strings.

    Clients and Services are using JSON serialisation to exchange data.

    -

    The D-Bus interface is defined by:

    - - - -

    The signature of any member of the interface is string -> string -for JSON -> JSON.

    - -

    This is the normal case. In case of error, the current implementation -returns a dbus error as a string.

    - -

    Here an example using dbus-send to query data on -installed applications.

    - +

    The signature of any member of the interface is string -> string for JSON -> JSON.

    +

    This is the normal case. In case of error, the current implementation returns a dbus error as a string.

    +

    Here an example using dbus-send to query data on installed applications.

    dbus-send --session --print-reply \
    ---dest=org.AGL.afm.user \
    -/org/AGL/afm/user \
    -org.AGL.afm.user.runnables string:true
    -
    - - -

    Using afm-util

    - -

    The command line tool afm-util uses dbus-send to send -orders to afm-user-daemon. This small scripts allows to -send command to afm-user-daemon either interactively -at shell prompt or scriptically.

    - + --dest=org.AGL.afm.user \ + /org/AGL/afm/user \ + org.AGL.afm.user.runnables string:true +

    Using afm-util

    +

    The command line tool afm-util uses dbus-send to send orders to afm-user-daemon. This small scripts allows to send command to afm-user-daemon either interactively at shell prompt or scriptically.

    The syntax is simple: it accept a command and when requires attached arguments.

    -

    Here is the summary of afm-util:

    - - - +

    list the runnable widgets installed

    + +

    install the wgt file

    + +

    remove the installed widget of id

    + +

    print detail about the installed widget of id

    + +

    list the running instance

    + +

    start an instance of the widget of id

    + +

    terminate the running instance rid

    + +

    stop the running instance rid

    + +

    continue the previously rid

    + +

    get status of the running instance rid

    Here is how to list applications using afm-util:

    - -
    afm-util runnables
    -
    - +
    afm-util runnables

    - - -

    The protocol over D-Bus

    - +

    The protocol over D-Bus

    Recall:

    - - -
    - - -

    Method org.AGL.afm.user.detail

    - +

    Method org.AGL.afm.user.detail

    Description: Get details about an application from its id.

    -

    Input: the id of the application as below.

    -

    Either just a string:

    - -
    "appli@x.y"
    -
    - -

    Or an object having the field “id” of type string:

    - -
    {"id":"appli@x.y"}
    -
    - -

    Output: A JSON object describing the application containing -the fields described below.

    - +
    "appli@x.y"
    +

    Or an object having the field "id" of type string:

    +
    {"id":"appli@x.y"}
    +

    Output: A JSON object describing the application containing the fields described below.

    {
    -  "id":          string, the application id (id@version)
    -  "version":     string, the version of the application
    -  "width":       integer, requested width of the application
    -  "height":      integer, resqueted height of the application
    -  "name":        string, the name of the application
    -  "description": string, the description of the application
    -  "shortname":   string, the short name of the application
    -  "author":      string, the author of the application
    -}
    -
    - + "id": string, the application id (id@version) + "version": string, the version of the application + "width": integer, requested width of the application + "height": integer, resqueted height of the application + "name": string, the name of the application + "description": string, the description of the application + "shortname": string, the short name of the application + "author": string, the author of the application +}
    - - -

    Method org.AGL.afm.user.runnables

    - +

    Method org.AGL.afm.user.runnables

    Description: Get the list of applications that can be run.

    -

    Input: any valid json entry, can be anything except null.

    - -

    output: An array of description of the runnable applications. -Each item of the array contains an object containing the detail of -an application as described above for the method -org.AGL.afm.user.detail.

    - +

    output: An array of description of the runnable applications. Each item of the array contains an object containing the detail of an application as described above for the method org.AGL.afm.user.detail.


    - - -

    Method org.AGL.afm.user.install

    - +

    Method org.AGL.afm.user.install

    Description: Install an application from its widget file.

    - -

    If an application of the same id and version exists, it is not -reinstalled except when force=true.

    - -

    Applications are installed in the subdirectories of the common directory -reserved for applications. -If root is specified, the application is installed under -sub-directories of defined root.

    - -

    Note that this methods is a simple accessor to the method -org.AGL.afm.system.install of afm-system-daemon.

    - -

    After the installation and before returning to the sender, -afm-user-daemon sends the signal org.AGL.afm.user.changed.

    - -

    Input: The path of widget file to be installed. Optionally, -a flag to force reinstallation and/or a root directory.

    - +

    If an application of the same id and version exists, it is not reinstalled except when force=true.

    +

    Applications are installed in the subdirectories of the common directory reserved for applications. If root is specified, the application is installed under sub-directories of defined root.

    +

    Note that this methods is a simple accessor to the method org.AGL.afm.system.install of afm-system-daemon.

    +

    After the installation and before returning to the sender, afm-user-daemon sends the signal org.AGL.afm.user.changed.

    +

    Input: The path of widget file to be installed. Optionally, a flag to force reinstallation and/or a root directory.

    Simple form a simple string containing the absolute widget path:

    - -
    "/a/path/driving/to/the/widget"
    -
    - +
    "/a/path/driving/to/the/widget"

    Or an object:

    -
    {
    -  "wgt": "/a/path/to/the/widget",
    -  "force": false,
    -  "root": "/a/path/to/the/root"
    -}
    -
    - -

    “wgt” and “root” MUST be absolute paths.

    - -

    output: An object containing field “added” to use as application ID.

    - -
    {"added":"appli@x.y"}
    -
    - + "wgt": "/a/path/to/the/widget", + "force": false, + "root": "/a/path/to/the/root" +} +

    "wgt" and "root" MUST be absolute paths.

    +

    output: An object containing field "added" to use as application ID.

    +
    {"added":"appli@x.y"}

    - - -

    Method org.AGL.afm.user.uninstall

    - +

    Method org.AGL.afm.user.uninstall

    Description: Uninstall an application from its id.

    - -

    Note that this methods is a simple accessor to -org.AGL.afm.system.uninstall method from afm-system-daemon.

    - -

    After the uninstallation and before returning to the sender, -afm-user-daemon sends the signal org.AGL.afm.user.changed.

    - -

    Input: the id of the application and, optionally, the path to -application root.

    - +

    Note that this methods is a simple accessor to org.AGL.afm.system.uninstall method from afm-system-daemon.

    +

    After the uninstallation and before returning to the sender, afm-user-daemon sends the signal org.AGL.afm.user.changed.

    +

    Input: the id of the application and, optionally, the path to application root.

    Either a string:

    - -
    "appli@x.y"
    -
    - +
    "appli@x.y"

    Or an object:

    -
    {
    -  "id": "appli@x.y",
    -  "root": "/a/path/to/the/root"
    -}
    -
    - -

    output: the value ‘true’.

    - + "id": "appli@x.y", + "root": "/a/path/to/the/root" +} +

    output: the value 'true'.


    - - -

    Method org.AGL.afm.user.start

    - +

    Method org.AGL.afm.user.start

    Description:

    - -

    Input: the id of the application and, optionally, the -start mode as below.

    - +

    Input: the id of the application and, optionally, the start mode as below.

    Either just a string:

    - -
    "appli@x.y"
    -
    - -

    Or an object containing field “id” of type string and -optionally a field mode:

    - -
    {"id":"appli@x.y","mode":"local"}
    -
    - -

    The field “mode” is a string equal to either “local” or “remote”.

    - +
    "appli@x.y"
    +

    Or an object containing field "id" of type string and optionally a field mode:

    +
    {"id":"appli@x.y","mode":"local"}
    +

    The field "mode" is a string equal to either "local" or "remote".

    output: The runid of the application launched. runid is an integer.

    -
    - - -

    Method org.AGL.afm.user.terminate

    - +

    Method org.AGL.afm.user.terminate

    Description: Terminates the application attached to runid.

    -

    Input: The runid (an integer) of running instance to terminate.

    - -

    output: the value ‘true’.

    - +

    output: the value 'true'.


    - - -

    Method org.AGL.afm.user.stop

    - +

    Method org.AGL.afm.user.stop

    Description: Stops the application attached to runid until terminate or continue.

    -

    Input: The runid (integer) of the running instance to stop.

    - -

    output: the value ‘true’.

    - +

    output: the value 'true'.


    - - -

    Method org.AGL.afm.user.continue

    - +

    Method org.AGL.afm.user.continue

    Description: Continues the application attached to runid previously stopped.

    -

    Input: The runid (integer) of the running instance to continue.

    - -

    output: the value ‘true’.

    - +

    output: the value 'true'.


    - - -

    Method org.AGL.afm.user.state

    - +

    Method org.AGL.afm.user.state

    Description: Get informations about a running instance of runid.

    -

    Input: The runid (integer) of the running instance inspected.

    - -

    output: An object describing instance state. It contains: -the runid (integer), the id of the running application (string), -the state of the application (string either: “starting”, “running”, “stopped”).

    - +

    output: An object describing instance state. It contains: the runid (integer), the id of the running application (string), the state of the application (string either: "starting", "running", "stopped").

    Example of returned state:

    -
    {
    -  "runid": 2,
    -  "state": "running",
    -  "id": "appli@x.y"
    -}
    -
    - + "runid": 2, + "state": "running", + "id": "appli@x.y" +}
    - - -

    Method org.AGL.afm.user.runners

    - +

    Method org.AGL.afm.user.runners

    Description: Get the list of currently running instances.

    -

    Input: anything.

    - -

    output: An array of states, one per running instance, as returned by -the methodd org.AGL.afm.user.state.

    +

    output: An array of states, one per running instance, as returned by the methodd org.AGL.afm.user.state.

    diff --git a/doc/application-framework.html b/doc/application-framework.html index e909b77..9c51b8e 100644 --- a/doc/application-framework.html +++ b/doc/application-framework.html @@ -1,125 +1,80 @@ + - - + + + + + + Application framework + + + - -

    Application framework

    - +
    +

    Application framework

    +

    José Bollo

    +

    Fulup Ar Foll

    +

    30 mai 2016

    +
    + +

    Application framework

    version: 1
     Date:    30 mai 2016
    -Author:  José Bollo
    -
    - -

    - - -

    Foreword

    - -

    This document describes application framework fundamentals. -FCF (Fully Conform to Specification) implementation is still under development. -It may happen that current implementation somehow diverges with specifications.

    - - -

    Overview

    - -

    The application framework on top of the security framework -provides components to install and uninstall applications -as well as to run them in a secured environment.

    - -

    The goal of the framework is to manage applications and hide security details -to applications.

    - -

    For the reasons explained in introduction, it was choose not to reuse Tizen -application framework directly, but to rework a new framework inspired from Tizen.

    - -

    fundamentals remain identical: the applications are distributed -in a digitally signed container that should match widget specifications -normalized by the W3C. This is described by the technical -recommendations widgets and widgets-digsig of the W3 consortium.

    - -

    As today this model allows the distribution of HTML, QML and binary applications -but it could be extended to any other class of applications.

    - -

    The management of widget package signatures. -Current model is only an initial step, it might be extended in the -future to include new feature (ie: incremental delivery).

    - - -

    Comparison to other frameworks

    - - -

    Tizen framework

    - - -

    xdg-app

    - - -

    ostro

    - - -

    organization of directory of applications

    - +Author: José Bollo +

    TABLE-OF-CONTENT-HERE

    +

    Foreword

    +

    This document describes application framework fundamentals. FCF (Fully Conform to Specification) implementation is still under development. It may happen that current implementation somehow diverges with specifications.

    +

    Overview

    +

    The application framework on top of the security framework provides components to install and uninstall applications as well as to run them in a secured environment.

    +

    The goal of the framework is to manage applications and hide security details to applications.

    +

    For the reasons explained in introduction, it was choose not to reuse Tizen application framework directly, but to rework a new framework inspired from Tizen.

    +

    fundamentals remain identical: the applications are distributed in a digitally signed container that should match widget specifications normalized by the W3C. This is described by the technical recommendations widgets and widgets-digsig of the W3 consortium.

    +

    As today this model allows the distribution of HTML, QML and binary applications but it could be extended to any other class of applications.

    +

    The management of widget package signatures. Current model is only an initial step, it might be extended in the future to include new feature (ie: incremental delivery).

    +

    Comparison to other frameworks

    +

    Tizen framework

    +

    xdg-app

    +

    ostro

    +

    organization of directory of applications

    The main path for applications are: APPDIR/PKGID/VER.

    -

    Where:

    - - - -

    The advantage of such an organization is to allow several versions to live together. -This is required for multiple reasons (ie: roll back) and to comply with developers habits.

    - - -

    Identity of installed files

    - -

    All the files are installed as user “userapp” and group “userapp”. -All files have rw(x) for user and r-(x) for group and others.

    - +

    The advantage of such an organization is to allow several versions to live together. This is required for multiple reasons (ie: roll back) and to comply with developers habits.

    +

    Identity of installed files

    +

    All the files are installed as user "userapp" and group "userapp". All files have rw(x) for user and r-(x) for group and others.

    This allows any user to read files.

    - - -

    labeling the directories of applications

    - - -

    organization of data

    - +

    labeling the directories of applications

    +

    organization of data

    The data of a user are contain within its directory and are labeled using the application labels

    - - -

    Setting Smack rules for the application

    - +

    Setting Smack rules for the application

    For Tizen, the following rules are set by the security manager for each application.

    -
    System ~APP~             rwx
     System ~PKG~             rwxat
     System ~PKG~::RO         rwxat
    @@ -135,15 +90,9 @@ User   ~PKG~::RO         rwxat
     ~APP~  User::Home        rxl
     ~APP~  User::App::Shared rwxat
     ~APP~  ~PKG~             rwxat
    -~APP~  ~PKG~::RO         rxl
    -
    - -

    Here, ~PKG~ is the identifier of the package and ~APP~ is the identifier of the application.

    - - -

    What user can run an application?

    - -

    Not all user are able to run all applications. -How to manage that?

    +~APP~ ~PKG~::RO rxl +

    Here, PKG is the identifier of the package and APP is the identifier of the application.

    +

    What user can run an application?

    +

    Not all user are able to run all applications. How to manage that?

    diff --git a/doc/overview.html b/doc/overview.html index 999b247..884a53c 100644 --- a/doc/overview.html +++ b/doc/overview.html @@ -1,49 +1,46 @@ + - - + + + + + AGL framework, overview of the proposal of IoT.bzh + + + - -

    AGL framework, overview of the proposal of IoT.bzh

    - +
    +

    AGL framework, overview of the proposal of IoT.bzh

    +

    José Bollo

    +

    29 mai 2016

    +
    + +

    AGL framework, overview of the proposal of IoT.bzh

    version: 1
     Date:    29 mai 2016
    -Author:  José Bollo
    -
    - -

    - - -

    Foreword

    - -

    This document describes what we intend to do. It may happen that our -current implementation and the content of this document differ.

    - -

    In case of differences, it is assumed that this document is right -and the implementation is wrong.

    - - -

    Introduction

    - -

    During the first works in having the security model of Tizen -integrated in AGL (Automotive Grade Linux) distribution, it became -quickly obvious that the count of components specific to Tizen -to integrate was huge.

    - +Author: José Bollo +

    TABLE-OF-CONTENT-HERE

    +

    Foreword

    +

    This document describes what we intend to do. It may happen that our current implementation and the content of this document differ.

    +

    In case of differences, it is assumed that this document is right and the implementation is wrong.

    +

    Introduction

    +

    During the first works in having the security model of Tizen integrated in AGL (Automotive Grade Linux) distribution, it became quickly obvious that the count of components specific to Tizen to integrate was huge.

    Here is a minimal list of what was needed:

    - - - -

    But this list is complete because many dependencies are hidden. -Those hidden dependencies are including some common libraries but also many -tizen specific sub-components (iniparser, bundle, dlog, libtzplatform-config, -db-util, vconf-buxton, …).

    - -

    This is an issue because AGL is not expected to be Tizen. Taking it would -either need to patch it for removing unwanted components or to take all -of them.

    - -

    However, a careful study of the core components of the security framework -of Tizen showed that their dependencies to Tizen are light (and since some -of our work, there is no more dependency to tizen). -Those components are cynara, security-manager, D-Bus aware of cynara.

    - -

    Luckyly, these core security components of Tizen are provided -by meta-intel-iot-security, a set of yocto layers. -These layers were created by Intel to isolate Tizen specific security -components from the initial port of Tizen to Yocto. -The 3 layers are providing components for:

    - +

    But this list is complete because many dependencies are hidden. Those hidden dependencies are including some common libraries but also many tizen specific sub-components (iniparser, bundle, dlog, libtzplatform-config, db-util, vconf-buxton, ...).

    +

    This is an issue because AGL is not expected to be Tizen. Taking it would either need to patch it for removing unwanted components or to take all of them.

    +

    However, a careful study of the core components of the security framework of Tizen showed that their dependencies to Tizen are light (and since some of our work, there is no more dependency to tizen). Those components are cynara, security-manager, D-Bus aware of cynara.

    +

    Luckyly, these core security components of Tizen are provided by meta-intel-iot-security, a set of yocto layers. These layers were created by Intel to isolate Tizen specific security components from the initial port of Tizen to Yocto. The 3 layers are providing components for:

    - -

    The figure below shows the history of these layers.

    - -
                  2014         2015
    +
                      2014         2015
     Tizen OBS ----------+--------------------------->
    -                 \
    -                  \
    - Tizen Yocto       +---------+-------------->
    -                              \
    -                               \
    -   meta-intel-iot-security      +----------->
    -
    - -

    We took the decision to use these security layers that provides the -basis of the Tizen security, the security framework.

    - -

    For the components of the application framework, built top of -the security framework, instead of pulling the huge set of packages -from Tizen, we decided to refit it by developping a tiny set of -components that would implement the same behaviour but without all -the dependencies and with minor architectural improvements for AGL.

    - -

    These components are afm-system-daemon and afm-user-daemon. -They provides infrastructure for installing, uninstalling, -launching, terminating, stopping and resuming applications in -a multi user secure environment.

    - -

    A third component exists in the framework, the binder afb-daemon. -The binder provides the easiest way to provide secured API for -any tier. Currently, the use of the binder is not absolutely mandatory.

    - -

    This documentation explains the framework created by IoT.bzh -by rewriting the Tizen Application Framework. Be aware of the -previous foreword.

    - - -

    Overview

    - -

    The figure below shows the major components of the framework -and their interactions going through the following scenario: -APPLICATION installs an other application and then launch it.

    - + \ + \ + Tizen Yocto +---------+--------------> + \ + \ + meta-intel-iot-security +----------->
    +

    We took the decision to use these security layers that provides the basis of the Tizen security, the security framework.

    +

    For the components of the application framework, built top of the security framework, instead of pulling the huge set of packages from Tizen, we decided to refit it by developping a tiny set of components that would implement the same behaviour but without all the dependencies and with minor architectural improvements for AGL.

    +

    These components are afm-system-daemon and afm-user-daemon. They provides infrastructure for installing, uninstalling, launching, terminating, stopping and resuming applications in a multi user secure environment.

    +

    A third component exists in the framework, the binder afb-daemon. The binder provides the easiest way to provide secured API for any tier. Currently, the use of the binder is not absolutely mandatory.

    +

    This documentation explains the framework created by IoT.bzh by rewriting the Tizen Application Framework. Be aware of the previous foreword.

    +

    Overview

    +

    The figure below shows the major components of the framework and their interactions going through the following scenario: APPLICATION installs an other application and then launch it.

    +-----------------------------------------------------------------------+
     |                                 User                                  |
     |  ................................                                     |
    @@ -166,126 +118,54 @@ APPLICATION installs an other application and then launch it.

    | +---------------------+ +-------------------------+ | | | | System | -+-----------------------------------------------------------------------+ -
    - ++-----------------------------------------------------------------------+

    Let follow the sequence of calls:

    - -
      +
      1. APPLICATION calls its binder to install the OTHER application.

      2. -
      3. The plugin afm-main-plugin of the binder calls, through -D-Bus system, the system daemon to install the OTHER application.

      4. -
      5. The system D-Bus checks wether APPLICATION has the permission -or not to install applications by calling CYNARA.

      6. -
      7. The system D-Bus transmits the request to afm-system-daemon.

        - -

        afm-system-daemon checks the application to install, its -signatures and rights and install it.

      8. -
      9. afm-system-daemon calls SECURITY-MANAGER for fullfilling -security context of the installed application.

      10. -
      11. SECURITY-MANAGER calls CYNARA to install initial permissions -for the application.

      12. +
      13. The plugin afm-main-plugin of the binder calls, through D-Bus system, the system daemon to install the OTHER application.

      14. +
      15. The system D-Bus checks wether APPLICATION has the permission or not to install applications by calling CYNARA.

      16. +
      17. The system D-Bus transmits the request to afm-system-daemon.

      18. +
      +

      afm-system-daemon checks the application to install, its signatures and rights and install it.

      +
        +
      1. afm-system-daemon calls SECURITY-MANAGER for fullfilling security context of the installed application.

      2. +
      3. SECURITY-MANAGER calls CYNARA to install initial permissions for the application.

      4. APPLICATION call its binder to start the nearly installed OTHER application.

      5. -
      6. The plugin afm-main-plugin of the binder calls, through -D-Bus session, the user daemon to launch the OTHER application.

      7. -
      8. The session D-Bus checks wether APPLICATION has the permission -or not to start an application by calling CYNARA.

      9. +
      10. The plugin afm-main-plugin of the binder calls, through D-Bus session, the user daemon to launch the OTHER application.

      11. +
      12. The session D-Bus checks wether APPLICATION has the permission or not to start an application by calling CYNARA.

      13. The session D-Bus transmits the request to afm-user-daemon.

      14. -
      15. afm-user-daemon checks wether APPLICATION has the permission -or not to start the OTHER application CYNARA.

      16. -
      17. afm-user-daemon uses SECURITY-MANAGER features to set -the seciruty context for the OTHER application.

      18. +
      19. afm-user-daemon checks wether APPLICATION has the permission or not to start the OTHER application CYNARA.

      20. +
      21. afm-user-daemon uses SECURITY-MANAGER features to set the seciruty context for the OTHER application.

      22. afm-user-daemon launches the OTHER application.

      - - -

      This scenario does not cover all the features of the frameworks. -Shortly because details will be revealed in the next chapters, -the components are:

      - +

      This scenario does not cover all the features of the frameworks. Shortly because details will be revealed in the next chapters, the components are:

        -
      • SECURITY-MANAGER: in charge of setting Smack contexts and rules, -of setting groups, and, of creating initial content of CYNARA rules -for applications.

      • -
      • CYNARA: in charge of handling API access permissions by users and by -applications.

      • -
      • D-Bus: in charge of checking security of messaging. The usual D-Bus -security rules are enhanced by CYNARA checking rules.

      • +
      • SECURITY-MANAGER: in charge of setting Smack contexts and rules, of setting groups, and, of creating initial content of CYNARA rules for applications.

      • +
      • CYNARA: in charge of handling API access permissions by users and by applications.

      • +
      • D-Bus: in charge of checking security of messaging. The usual D-Bus security rules are enhanced by CYNARA checking rules.

      • afm-system-daemon: in charge of installing and uninstalling applications.

      • -
      • afm-user-daemon: in charge of listing applications, querying application details, -starting, terminating, stopping, resuming applications and their instances -for a given user context.

      • -
      • afb-binder: in charge of serving resources and features through an -HTTP interface.

      • -
      • afm-main-plugin: This plugin allows applications to use the API -of the AGL framework.

      • +
      • afm-user-daemon: in charge of listing applications, querying application details, starting, terminating, stopping, resuming applications and their instances for a given user context.

      • +
      • afb-binder: in charge of serving resources and features through an HTTP interface.

      • +
      • afm-main-plugin: This plugin allows applications to use the API of the AGL framework.

      - - - -

      Links between the “Security framework” and the “Application framework”

      - -

      The security framework refers to the security model used to ensure -security and to the tools that are provided for implementing that model.

      - -

      The security model refers to how DAC (Discretionnary Access Control), -MAC (Mandatory Access Control) and Capabilities are used by the system -to ensure security and privacy. It also includes features of reporting -using audit features and by managing logs and alerts.

      - -

      The application framework manages the applications: -installing, uninstalling, starting, stopping, listing …

      - -

      The application framework uses the security model/framework -to ensure the security and the privacy of the applications that -it manages.

      - -

      The application framework must be compliant with the underlyiong -security model/framework. But it should hide it to the applications.

      - - -

      The security framework

      - -

      The implemented security model is the security model of Tizen 3. -This model is described here.

      - -

      The security framework then comes from Tizen 3 but through -the meta-intel. -It includes: Security-Manager, Cynara -and D-Bus compliant to Cynara.

      - -

      Two patches are applied to the security-manager. These patches are removing -dependencies to packages specific of Tizen but that are not needed by AGL. -None of these patches adds or removes any behaviour.

      - -

      Theoritically, the security framework/model is an implementation details -that should not impact the layers above the application framework.

      - -

      The security framework of Tizen provides “nice lad” a valuable component to -scan log files and analyse auditing. This component is still in developement.

      - - -

      The application framework

      - -

      The application framework on top of the security framework -provides the components to install and uninstall applications -and to run it in a secured environment.

      - -

      The goal is to manage applications and to hide the details of -the security framework to the applications.

      - -

      For the reasons explained in introduction, we did not used the -application framework of Tizen as is but used an adaptation of it.

      - -

      The basis is kept identical: the applications are distributed -in a digitally signed container that must match the specifications -of widgets (web applications). This is described by the technical -recomendations widgets and widgets-digsig of the W3 consortium.

      - + +

      The security framework refers to the security model used to ensure security and to the tools that are provided for implementing that model.

      +

      The security model refers to how DAC (Discretionnary Access Control), MAC (Mandatory Access Control) and Capabilities are used by the system to ensure security and privacy. It also includes features of reporting using audit features and by managing logs and alerts.

      +

      The application framework manages the applications: installing, uninstalling, starting, stopping, listing ...

      +

      The application framework uses the security model/framework to ensure the security and the privacy of the applications that it manages.

      +

      The application framework must be compliant with the underlyiong security model/framework. But it should hide it to the applications.

      +

      The security framework

      +

      The implemented security model is the security model of Tizen 3. This model is described here.

      +

      The security framework then comes from Tizen 3 but through the meta-intel. It includes: Security-Manager, Cynara and D-Bus compliant to Cynara.

      +

      Two patches are applied to the security-manager. These patches are removing dependencies to packages specific of Tizen but that are not needed by AGL. None of these patches adds or removes any behaviour.

      +

      Theoritically, the security framework/model is an implementation details that should not impact the layers above the application framework.

      +

      The security framework of Tizen provides "nice lad" a valuable component to scan log files and analyse auditing. This component is still in developement.

      +

      The application framework

      +

      The application framework on top of the security framework provides the components to install and uninstall applications and to run it in a secured environment.

      +

      The goal is to manage applications and to hide the details of the security framework to the applications.

      +

      For the reasons explained in introduction, we did not used the application framework of Tizen as is but used an adaptation of it.

      +

      The basis is kept identical: the applications are distributed in a digitally signed container that must match the specifications of widgets (web applications). This is described by the technical recomendations widgets and widgets-digsig of the W3 consortium.

      This model allows the distribution of HTML, QML and binary applications.

      - -

      The management of signatures of the widget packages -This basis is not meant as being rigid and it can be extended in the -futur to include for example incremental delivery.

      +

      The management of signatures of the widget packages This basis is not meant as being rigid and it can be extended in the futur to include for example incremental delivery.

      diff --git a/doc/quick-tutorial.html b/doc/quick-tutorial.html index ef3e9f7..f1f96ed 100644 --- a/doc/quick-tutorial.html +++ b/doc/quick-tutorial.html @@ -1,15 +1,24 @@ - - -quick-tutorial - - + + + + + AGL Application Framework: A Quick Tutorial + + + -

      AGL Application Framework: A Quick Tutorial

      - -

      -

      - - - + +

      AGL Application Framework: A Quick Tutorial

      +

      [TOC]

      Introduction

      - -

      This document proposes a quick tutorial to demonstrate the major functionnalities of the AGL Application Framework. For more complete information, please refer to the inline documentation available in the main git repository:
      -https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-main
      -https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-binder

      - -

      For more information on AGL, please visit:
      -https://www.automotivelinux.org/

      - -
      - - - +

      This document proposes a quick tutorial to demonstrate the major functionnalities of the AGL Application Framework. For more complete information, please refer to the inline documentation available in the main git repository: https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-main https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-binder

      +

      For more information on AGL, please visit: https://www.automotivelinux.org/

      +

      Sample applications

      - -

      4 sample applications (.wgt files) are prebuilt and available at the following address:
      -https://github.com/iotbzh/afm-widget-examples

      - +

      4 sample applications (.wgt files) are prebuilt and available at the following address: https://github.com/iotbzh/afm-widget-examples

      You can get them by cloning this git repository on your desktop (will be useful later in this tutorial):

      - - - -
      $ git clone https://github.com/iotbzh/afm-widget-examples
      - - - +
      $ git clone https://github.com/iotbzh/afm-widget-examples

      Using the CLI tool

      - - -

      Setup Environment

      -

      Connect your AGL target board to the network and copy some sample widgets on it through SSH (set BOARDIP with your board IP address) :

      - - - -
      $ cd afm-widget-examples
      -$ BOARDIP=1.2.3.4
      -$ scp *.wgt root@$BOARDIP:~/
      - +
      $ cd afm-widget-examples
      +$ BOARDIP=1.2.3.4
      +$ scp *.wgt root@$BOARDIP:~/

      Connect through SSH on the target board and check for Application Framework daemons:

      -
      $ ssh root@$BOARDIP
       root@porter:~# ps -ef|grep bin/afm
       afm        409     1  0 13:00 ?        00:00:00 /usr/bin/afm-system-daemon
       root       505   499  0 13:01 ?        00:00:00 /usr/bin/afm-user-daemon
      -root       596   550  0 13:22 pts/0    00:00:00 grep afm
      -
      - -

      We can see that there are two daemons running:
      -* afm-system-daemon runs with a system user ‘afm’ and is responsible for installing/uninstalling packages
      -* afm-user-daemon runs as a user daemon (currently as root because it’s the only real user on the target board) and is responsible for the whole lifecycle of the applications running inside the user session.

      - -

      The application framework has a tool running on the Command Line Interface (CLI). Using the afm-util command, you can install, uninstall, list, run, stop … applications.

      - -

      To begin, run ‘afm-util help’ to get a quick help on commands:

      - +root 596 550 0 13:22 pts/0 00:00:00 grep afm +

      We can see that there are two daemons running: * afm-system-daemon runs with a system user 'afm' and is responsible for installing/uninstalling packages * afm-user-daemon runs as a user daemon (currently as root because it's the only real user on the target board) and is responsible for the whole lifecycle of the applications running inside the user session.

      +

      The application framework has a tool running on the Command Line Interface (CLI). Using the afm-util command, you can install, uninstall, list, run, stop ... applications.

      +

      To begin, run 'afm-util help' to get a quick help on commands:

      root@porter:~# afm-util help
       usage: afm-util command [arg]
       
      @@ -132,181 +102,76 @@ The commands are:
         continue rid   continue the previously rid
       
         status rid
      -  state rid     get status of the running instance rid
      -
      - - - + state rid get status of the running instance rid

      Install an application

      -

      You can then install your first application:

      -
      root@porter:~# afm-util install /home/root/annex.wgt 
      -{ "added": "webapps-annex@0.0" }
      -
      - -

      Let’s install a second application:

      - +{ "added": "webapps-annex@0.0" } +

      Let's install a second application:

      root@porter:~# afm-util install /home/root/memory-match.wgt 
      -{ "added": "webapps-memory-match@1.1" }
      -
      - +{ "added": "webapps-memory-match@1.1" }

      Note that usually, afm-util will return a JSON result, which is the common format for messages returned by the Application Framework daemons.

      - - -

      List installed applications

      -

      You can then list all installed applications:

      -
      root@porter:~# afm-util list
      -[ { "id": "webapps-annex@0.0", "version": "0.0.10", "width": 0, "height": 0, "name": "Annex", "description": "Reversi\/Othello", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" },
      - { "id": "webapps-memory-match@1.1", "version": "1.1.7", "width": 0, "height": 0, "name": "MemoryMatch", "description": "Memory match", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" } ]
      -
      - +[ { "id": "webapps-annex@0.0", "version": "0.0.10", "width": 0, "height": 0, "name": "Annex", "description": "Reversi\/Othello", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" }, + { "id": "webapps-memory-match@1.1", "version": "1.1.7", "width": 0, "height": 0, "name": "MemoryMatch", "description": "Memory match", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" } ]

      Here, we can see the two previously installed applications.

      - - -

      Get information about an application

      - -

      Let’s get some details about the first application:

      - +

      Let's get some details about the first application:

      root@porter:~# afm-util info webapps-annex@0.0
      -{ "id": "webapps-annex@0.0", "version": "0.0.10", "width": 0, "height": 0, "name": "Annex", "description": "Reversi\/Othello", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" }
      -
      - -

      Note that AGL applications are mostly handled by afm-util through their IDs. In our example, the application ID is ‘webapps-annex@0.0’.

      - - - +{ "id": "webapps-annex@0.0", "version": "0.0.10", "width": 0, "height": 0, "name": "Annex", "description": "Reversi\/Othello", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" } +

      Note that AGL applications are mostly handled by afm-util through their IDs. In our example, the application ID is 'webapps-annex@0.0'.

      Start application

      - -

      Let’s start the first application Annex:

      - +

      Let's start the first application Annex:

      root@porter:~# afm-util start webapps-annex@0.0
      -1
      -
      - +1

      As the application is a HTML5 game, you should then get a webview running with QML on the board display.

      - - -

      Security Context

      -

      The application has been started in the user session, with a dedicated security context, enforced by SMACK. To illustrate this, we can take a look at the running processes and their respective SMACK labels:

      -
      root@porter:~# ps -efZ |grep webapps-annex | grep -v grep
       User::App::webapps-annex        root       716   491  0 13:19 ?        00:00:00 /usr/bin/afb-daemon --mode=local --readyfd=8 --alias=/icons /usr/share/afm/icons --port=12348 --rootdir=/usr/share/afm/applications/webapps-annex/0.0 --token=7D6D2F16 --sessiondir=/home/root/app-data/webapps-annex/.afb-daemon
      -User::App::webapps-annex        root       717   491  0 13:19 ?        00:00:00 /usr/bin/qt5/qmlscene http://localhost:12348/index.html?token=7D6D2F16 /usr/bin/web-runtime-webkit.qml
      -
      - -

      In the previous result, we see that the application is composed of two processes:
      -* the application binder (afb-daemon)
      -* the application UI (qmlscene …)

      - -

      While most system processes run with the label ‘System’, we see that the application runs with a specific SMACK label ‘User::App::webapps-annex’: this label is used to force the application to follow a Mandatory Access Control (MAC) scheme. This means that those processes run in their own security context, isolated from the rest of the system (and other applications). Global security rules can then be applied to restrict access to all other user or system resources.

      - - - +User::App::webapps-annex root 717 491 0 13:19 ? 00:00:00 /usr/bin/qt5/qmlscene http://localhost:12348/index.html?token=7D6D2F16 /usr/bin/web-runtime-webkit.qml +

      In the previous result, we see that the application is composed of two processes: * the application binder (afb-daemon) * the application UI (qmlscene ...)

      +

      While most system processes run with the label 'System', we see that the application runs with a specific SMACK label 'User::App::webapps-annex': this label is used to force the application to follow a Mandatory Access Control (MAC) scheme. This means that those processes run in their own security context, isolated from the rest of the system (and other applications). Global security rules can then be applied to restrict access to all other user or system resources.

      Check running applications

      -

      To check for running applications, just run:

      -
      root@porter:~# afm-util ps
      -[ { "runid": 1, "state": "running", "id": "webapps-annex@0.0" } ]
      -
      - -

      The ‘runid’ is the application instance ID and is used as an argument for the subcommands controlling the application runtime state (kill/stop/resume/status)

      - - - +[ { "runid": 1, "state": "running", "id": "webapps-annex@0.0" } ] +

      The 'runid' is the application instance ID and is used as an argument for the subcommands controlling the application runtime state (kill/stop/resume/status)

      Stop application

      -

      To stop the application that was just started (the one with RUNID 1), just run the stop command:

      -
      root@porter:~# afm-util terminate 1
      -true
      -
      - +true

      The application is now stopped, as confirmed by a list of running apps:

      -
      root@porter:~# afm-util ps
      -[ ]
      -
      - - - +[ ]

      Uninstall application

      -

      To uninstall an application, simply use its ID:

      -
      root@porter:~# afm-util uninstall webapps-annex@0.0
      -true
      -
      - +true

      Then list the installed apps to confirm the removal:

      -
      root@porter:~# afm-util list
      -[ { "id": "webapps-memory-match@1.1", "version": "1.1.7", "width": 0, "height": 0, "name": "MemoryMatch", "description": "Memory match", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" } ]
      -
      - - - -

      afm-client: a sample HTML5 ‘Homescreen’

      - +[ { "id": "webapps-memory-match@1.1", "version": "1.1.7", "width": 0, "height": 0, "name": "MemoryMatch", "description": "Memory match", "shortname": "", "author": "Todd Brandt <todd.e.brandt@intel.com>" } ] +

      afm-client: a sample HTML5 'Homescreen'

      afm-client is a HTML5 UI that allows to install/uninstall applications as well as starting/stopping them as already demonstrated with afm-util.

      - -

      The HTML5 UI is accessible remotely through this URL:
      -http://[board_ip]:1234/opa?token=132456789

      - - - +

      The HTML5 UI is accessible remotely through this URL: http://[board_ip]:1234/opa?token=132456789

      Installing an application

      - -

      By clicking on the ‘Upload’ button on the right, you can send an application package (WGT file) and install it. Select for example the file ‘rabbit.wgt’ that was cloned initially from the git repository afm-widget-examples.

      - -

      Then a popup requester ask for a confirmation: ‘Upload Application rabbit.wgt ?’. Click on the ‘Install’ button.

      - +

      By clicking on the 'Upload' button on the right, you can send an application package (WGT file) and install it. Select for example the file 'rabbit.wgt' that was cloned initially from the git repository afm-widget-examples.

      +

      Then a popup requester ask for a confirmation: 'Upload Application rabbit.wgt ?'. Click on the 'Install' button.

      You should then see some changes in the toolbar: a new icon appeared, representing the freshly installed application.

      - - -

      Running an application

      - -

      In the toolbar, click on the button representing the Rabbit application. You’ll get a popup asking to:
      -* start the application
      -* or get some info about it
      -* or uninstall it

      - -

      Click on the ‘start’ item: the application starts and should be visible as a webview on the target board display. Note that at this point, we could also run the application remotely, that is in the same browser as the Homescreen app. By default, the application framework is configured to run applications ‘locally’ on the board display.

      - - - +

      In the toolbar, click on the button representing the Rabbit application. You'll get a popup asking to: * start the application * or get some info about it * or uninstall it

      +

      Click on the 'start' item: the application starts and should be visible as a webview on the target board display. Note that at this point, we could also run the application remotely, that is in the same browser as the Homescreen app. By default, the application framework is configured to run applications 'locally' on the board display.

      Stopping an application

      - -

      In the Homescreen application, click again on the Rabbit application button, then select ‘stop’: the application then stops.

      - - - +

      In the Homescreen application, click again on the Rabbit application button, then select 'stop': the application then stops.

      Uninstalling an application

      - -

      From the same popup menu, you can select ‘uninstall’ to remove the application from the system. As a consequence, the application icon should disappear from the toolbar.

      - - - +

      From the same popup menu, you can select 'uninstall' to remove the application from the system. As a consequence, the application icon should disappear from the toolbar.

      afb-client: a template for Angular Applications

      - -

      Another package ‘afb-client’ is also available for testing.
      -This is a sample HTML5 application demonstrating various basic capabilities of the Binder daemon. It can be used by developers as a template to start writing real AGL Applications.

      - +

      Another package 'afb-client' is also available for testing. This is a sample HTML5 application demonstrating various basic capabilities of the Binder daemon. It can be used by developers as a template to start writing real AGL Applications.

      This application is not available as WGT file yet and it should be started manually without any specific security context:

      - -
      root@porter:~# /usr/bin/afb-daemon --mode=remote --port=1235 --token='' --sessiondir=/home/root/.afm-daemon --rootdir=/usr/share/agl/afb-client --alias=/icons:/usr/share/afm/icons
      -
      - -

      Then you can access it from a browser:
      -http://[board_ip]:1235/opa/?token=132456789

      - -

      afb-client is a simple application to demonstrate the built-in capabilities of the binder daemon (handling sessions and security tokens, testing POSTs uploads…) and was used during the application framework development to validate the proposed features.

      - \ No newline at end of file +
      root@porter:~# /usr/bin/afb-daemon --mode=remote --port=1235 --token='' --sessiondir=/home/root/.afm-daemon --rootdir=/usr/share/agl/afb-client --alias=/icons:/usr/share/afm/icons
      +

      Then you can access it from a browser: http://[board_ip]:1235/opa/?token=132456789

      +

      afb-client is a simple application to demonstrate the built-in capabilities of the binder daemon (handling sessions and security tokens, testing POSTs uploads...) and was used during the application framework development to validate the proposed features.

      + + diff --git a/doc/security-framework.html b/doc/security-framework.html index 38fb2f9..779d710 100644 --- a/doc/security-framework.html +++ b/doc/security-framework.html @@ -1,28 +1,37 @@ + - - + + + + + The security framework + + + - -

      The security framework

      - +
      +

      The security framework

      +

      José Bollo

      +

      29 mai 2016

      +
      + +

      The security framework

      version: 1
       Date:    29 mai 2016
      -Author:  José Bollo
      -
      - -

      - - -

      Setting Smack rules for the application

      - +Author: José Bollo +

      TABLE-OF-CONTENT-HERE

      +

      Setting Smack rules for the application

      For Tizen, the following rules are set by the security manager for each application.

      -
      System ~APP~             rwx
       System ~PKG~             rwxat
       System ~PKG~::RO         rwxat
      @@ -38,15 +47,9 @@ User   ~PKG~::RO         rwxat
       ~APP~  User::Home        rxl
       ~APP~  User::App::Shared rwxat
       ~APP~  ~PKG~             rwxat
      -~APP~  ~PKG~::RO         rxl
      -
      - -

      Here, ~PKG~ is the identifier of the package and ~APP~ is the identifier of the application.

      - - -

      What user can run an application?

      - -

      Not all user are able to run all applications. -How to manage that?

      +~APP~ ~PKG~::RO rxl +

      Here, PKG is the identifier of the package and APP is the identifier of the application.

      +

      What user can run an application?

      +

      Not all user are able to run all applications. How to manage that?

      diff --git a/doc/updt.sh b/doc/updt.sh index 1c9d023..5267ad5 100755 --- a/doc/updt.sh +++ b/doc/updt.sh @@ -1,47 +1,52 @@ #!/bin/bash -# the HTML template -main=' - - - - - -GENERATED-MARKDOWN-HERE - -' - -# substitute the pattern $1 by the content of the file $2 -subst() { - awk -v pat="$1" -v rep="$(sed 's:\\:\\\\:g' $2)" '{gsub(pat,rep);gsub(pat,"\\&");print}' +title() { + sed '/^[ \t]*$/d' "$1" | + sed '/^===/Q' | + sed '/^---/Q' | + sed 's/^# //;T;Q' | + sed 's/^## //;T;Q' | + sed '/^---/Q' } -# update the date field of file $1 -updadate() { - local x=$1 - local t=$(git log -n 1 --format=%ct $x) - [[ -n "$t" ]] || t=$(stat -c %Y $x) - local d=$(LANG= date -d @$t +"%d %B %Y") - sed -i "s/^\( Date: *\).*/\1$d/" $x +authors() { + git log --numstat --format='A %aN' -- "$1" | + awk '$1=="A"{sub(/^A /,"");a=$0; s[a]+=0; next}NF==3{s[a]+=($1+0)}END{for(a in s)print s[a]" : "a}' | + sort -nr | + sed 's/[^:]* : //' | + sed '1!s/^/; /' | + tr -d '\n' +} + +dateof() { + local file="$1" + local t=$(git log -n 1 --format=%ct "$file") + [[ -n "$t" ]] || t=$(stat -c %Y "$file") + LANG= date -d @$t +"%d %B %Y" } +meta() { + local file="$1" + local t=$(title "$file") + local a=$(authors "$file") + local d=$(dateof "$file") + echo "% $t" + echo "% $a" + echo "% $d" + cat "$file" +} + + # make the html file for $1 mkhtml() { local x=$1 local h=${x%%.md}.html - expand -i $x | sed 's:^ : :' > $h.pre - markdown -f toc,autolink $h.pre > $h.toc.no - markdown -Tf toc,autolink $h.pre > $h.toc.yes - head --bytes=-$(stat -c %s $h.toc.no) $h.toc.yes > $h.toc - echo "$main" | - subst GENERATED-MARKDOWN-HERE $h.toc.no | - subst TABLE-OF-CONTENT-HERE $h.toc > $h - rm $h.* + meta "$x" | + pandoc --css doc.css -f markdown -t html5 --toc > "$h" } # apply for x in *.md; do - updadate $x mkhtml $x done diff --git a/doc/widgets.html b/doc/widgets.html index 23bf891..1ea0178 100644 --- a/doc/widgets.html +++ b/doc/widgets.html @@ -1,98 +1,161 @@ + - - + + + + + + The widgets + + + + - -

      The widgets

      - +
      +

      The widgets

      +

      José Bollo

      +

      Fulup Ar Foll

      +

      24 juin 2016

      +
      + +

      The widgets

      version: 1
       Date:    30 mai 2016
      -Author:  José Bollo
      -
      - -

      - - -

      The widgets

      - -

      The widgets are described by the technical recommendations -widgets and widgets-digsig.

      - - -

      signature

      - -

      The application framework

      - -

      This is the original part of our work here

      - - -

      directory where are stored applications

      - -

      Applications can be installed in different places: the system itself, extension device. -On a phone application are typically installed on the sd card.

      - +Author: José Bollo +

      The widgets

      +

      The widgets are described by the technical recommendations widgets and widgets-digsig.

      +

      In summary, widgets are ZIP files that can be signed and whose content is described by the file .

      +

      The configuration file config.xml

      +

      This is one of the important file of the widget. It fully describes the widget.

      +

      Here is the example of the config file for the QML application SmartHome.

      +
      <?xml version="1.0" encoding="UTF-8"?>
      +<widget xmlns="http://www.w3.org/ns/widgets" id="smarthome" version="0.1">
      +  <name>SmartHome</name>
      +  <icon src="smarthome.png"/>
      +  <content src="qml/smarthome/smarthome.qml" type="text/vnd.qt.qml"/>
      +  <description>This is the Smarthome QML demo application. It shows some user interfaces for controlling an 
      +automated house. The user interface is completely done with QML.</description>
      +  <author>Qt team</author>
      +  <license>GPL</license>
      +</widget>
      +

      The most important items are:

      +
        +
      • <widget id="......">: gives the id of the widget. It must be unique.

      • +
      • <widget version="......">: gives the version of the widget

      • +
      • <icon src="...">: gives a path to the icon of the application (can be repeated with different sizes)

      • +
      • <content src="..." type="...">: this indicates the entry point and its type. The types handled are set through the file /etc/afm/afm-launch.conf

      • +
      +

      Further development will add handling of for requiring and providing permissions and services.

      +

      Tools for managing widgets

      +

      This project includes tools for managing widgets. These tools are:

      +
        +
      • 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.

      • +
      +

      For all these commands, a tiny help is available with options -h or --help.

      +

      There is no tool for unpacking a widget. For doing such operation, you can use the command unzip.

      +

      To list the files of a widget:

      +
      $ unzip -l WIDGET
      +

      To extract a widget in some directory:

      +
      $ unzip WIDGET -d DIRECTORY
      +

      Note that DIRECTORY will be created if needed.

      +

      Signing a widget

      +

      To sign a widget, you need a private key and its certificate.

      +

      The tool wgtpkg-sign creates or replace a signature file in the directory of the widget BEFORE its packaging.

      +

      There are two types of signature files: author and distributor.

      +

      Example 1: add an author signature

      +
      $ wgtpkg-sign -a -k me.key.pem -c me.cert.pem DIRECTORY
      +

      Example 2: add a distributor signature

      +
      $ wgtpkg-sign -k authority.key.pem -c authority.cert.pem DIRECTORY
      +

      Packing a widget

      +

      This operation can be done using the command zip but we provide the tool wgtpkg-pack that may add checking.

      +

      Example:

      +
      $ wgtpkg-pack DIRECTORY -o file.wgt
      +

      Getting data about a widget file

      +

      The command wgtpkg-info opens a widget file, reads its config.xml file and displays its content in a human readable way.

      +

      Writing a widget

      +

      What kind of application?

      +

      The file /etc/afm/afm-launch.conf explain how to launch applications. (It is the current state that use afm-user-daemon. In a future, it may be replace by systemd features.)

      +

      Currently the applications that can be run are:

      +
        +
      • binary applications: their type is application/x-executable

      • +
      • HTML5 applications: their type is text/html

      • +
      • QML applications: their type is text/vnd.qt.qml

      • +
      +

      The steps for writing a widget

      +
        +
      1. make your application

      2. +
      3. create its configuration file config.xml

      4. +
      5. sign it

      6. +
      7. pack it

      8. +
      +

      Fairly easy, no?

      +

      Organization of directory of applications

      +

      directory where are stored applications

      +

      Applications can be installed in different places: the system itself, extension device. On a phone application are typically installed on the sd card.

      This translates to:

      -
      • /usr/applications: system wide applications
      • /opt/applications: removable applications
      - - -

      From here those paths are referenced as: “APPDIR”.

      - - -

      Organization of directory of applications

      - +

      From here those paths are referenced as: "APPDIR".

      The main path for applications is: APPDIR/PKGID/VER.

      -

      Where:

      -
      • APPDIR is as defined above
      • PKGID is a directory whose name is the package identifier
      • VER is the version of the package MAJOR.MINOR
      - - -

      This organization has the advantage to allow several versions to leave together. -This is needed for some good reasons (rolling back) and also for less good reasons (user habits).

      - - -

      Identity of installed files

      - -

      All files are installed as user “userapp” and group “userapp”. -All files have rw(x) for user and r-(x) for group and others.

      - +

      This organization has the advantage to allow several versions to leave together. This is needed for some good reasons (rolling back) and also for less good reasons (user habits).

      +

      Identity of installed files

      +

      All files are installed as user "afm" and group "afm". All files have rw(x) for user and r-(x) for group and others.

      This allows every user to read every file.

      - - -

      labeling the directories of applications

      - - -

      organization of data

      - -

      The data of a user are in its directory and are labelled using the labels of the application

      +

      labeling the directories of applications

      +

      The data of a user are in its directory and are labelled by the security-manager using the labels of the application.

      diff --git a/doc/widgets.md b/doc/widgets.md index 3c77737..10f7f58 100644 --- a/doc/widgets.md +++ b/doc/widgets.md @@ -1,4 +1,3 @@ - The widgets =========== @@ -6,7 +5,6 @@ The widgets Date: 30 mai 2016 Author: José Bollo -TABLE-OF-CONTENT-HERE The widgets ----------- @@ -14,11 +12,148 @@ The widgets The widgets are described by the technical recommendations [widgets] and [widgets-digsig]. -### signature +In summary, **widgets are ZIP files that can be signed and +whose content is described by the file **. + +### The configuration file config.xml + +This is one of the important file of the widget. +It fully describes the widget. + +Here is the example of the config file for the QML application SmartHome. + +```xml + + + SmartHome + + + This is the Smarthome QML demo application. It shows some user interfaces for controlling an +automated house. The user interface is completely done with QML. + Qt team + GPL + +``` + +The most important items are: + +- **\**: gives the id of the widget. It must be unique. + +- **\**: gives the version of the widget + +- **\**: gives a path to the icon of the application + (can be repeated with different sizes) + +- **\**: this indicates the entry point and its type. + The types handled are set through the file /etc/afm/afm-launch.conf + +Further development will add handling of for requiring and providing +permissions and services. + +### Tools for managing widgets + +This project includes tools for managing widgets. +These tools are: + +- ***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. + +For all these commands, a tiny help is available with +options **-h** or **--help**. + +There is no tool for unpacking a widget. For doing such operation, +you can use the command **unzip**. + +To list the files of a widget: + +```bash +$ unzip -l WIDGET +``` + +To extract a widget in some directory: + +```bash +$ unzip WIDGET -d DIRECTORY +``` + +*Note that DIRECTORY will be created if needed*. + +### Signing a widget + +To sign a widget, you need a private key and its certificate. + +The tool **wgtpkg-sign** creates or replace a signature file in +the directory of the widget BEFORE its packaging. + +There are two types of signature files: author and distributor. + +Example 1: add an author signature -The application framework +```bash +$ wgtpkg-sign -a -k me.key.pem -c me.cert.pem DIRECTORY +``` -This is the original part of our work here +Example 2: add a distributor signature + +```bash +$ wgtpkg-sign -k authority.key.pem -c authority.cert.pem DIRECTORY +``` + +### Packing a widget + +This operation can be done using the command **zip** but +we provide the tool **wgtpkg-pack** that may add checking. + +Example: +```bash +$ wgtpkg-pack DIRECTORY -o file.wgt +``` + +### Getting data about a widget file + +The command **wgtpkg-info** opens a widget file, reads its **config.xml** +file and displays its content in a human readable way. + +Writing a widget +---------------- + +### What kind of application? + +The file **/etc/afm/afm-launch.conf** explain how to launch applications. +(It is the current state that use afm-user-daemon. In a future, it may be +replace by systemd features.) + +Currently the applications that can be run are: + +- binary applications: their type is ***application/x-executable*** + +- HTML5 applications: their type is ***text/html*** + +- QML applications: their type is ***text/vnd.qt.qml*** + +### The steps for writing a widget + +1. make your application + +2. create its configuration file **config.xml** + +3. sign it + +4. pack it + +Fairly easy, no? + +Organization of directory of applications +----------------------------------------- ### directory where are stored applications @@ -32,10 +167,6 @@ This translates to: From here those paths are referenced as: "APPDIR". - -Organization of directory of applications -========================================= - The main path for applications is: APPDIR/PKGID/VER. Where: @@ -47,23 +178,17 @@ Where: This organization has the advantage to allow several versions to leave together. This is needed for some good reasons (rolling back) and also for less good reasons (user habits). -Identity of installed files ---------------------------- +### Identity of installed files -All files are installed as user "userapp" and group "userapp". +All files are installed as user "afm" and group "afm". All files have rw(x) for user and r-(x) for group and others. This allows every user to read every file. +### labeling the directories of applications -labeling the directories of applications ------------------------------------------ - - -organization of data -==================== - -The data of a user are in its directory and are labelled using the labels of the application +The data of a user are in its directory and are labelled by the security-manager +using the labels of the application. [meta-intel]: https://github.com/01org/meta-intel-iot-security "A collection of layers providing security technologies" [widgets]: http://www.w3.org/TR/widgets "Packaged Web Apps" -- cgit 1.2.3-korg