agl security framework review -...

41
AGL security framework review José Bollo [email protected]

Upload: others

Post on 07-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

AGL security framework

reviewJosé Bollo

[email protected]

Page 2: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

History& high level

goals

Page 3: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 3

History of the security model

Tizen 2

Tizen 3

Ostro

AGL

Tizen IVI

June 2

014

Dec. 2

014

June 2015

Marc

h 2015

Nov. 2015

First tizen 3 security

release

OBS

YOCTO

AGL spec 1.0 may 28th

First meta-intel-iot-security release

Security model changesfrom tizen 2 to tizen 3

Dec. 2

016Meego

Integration to AGLStart of

refiing frameworkt

synchronization

Page 4: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 4

Goals of the security framework

● Security by design from day one– Adding security after the fact is just impossible

● Make security acceptable to developers– Keep buget and time to market objectives under control

● Open the system to partners– Good for business

● Provide abstraction above implementation– Security Implementation detail should be transparent to user/developpers

Page 5: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 5

Design philosophy

KEEP IT SIMPLEbut flying

Page 6: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 6

Why a refit version of Tizen framework?

Same featuresLess code

Photography © Sarah Klockars-Clauser for openphoto.net

Page 7: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 7

Why a refit version of Tizen framework?

Same featuresLess code

Easy to adapt,

change, maintain,

...

- platform/appfw/app-installers - platform/core/security/cert-svc - platform/core/appfw/ail - platform/core/appfw/aul-1 - platform/core/appfw/libslp-db-util - platform/core/appfw/pkgmgr-info - platform/core/appfw/slp-pkgmgr - tizen-platform-config - and probably some more...

- app-framework-main

Page 8: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 8

Binder added to AGL framework?

app-framework-main

app-framework-binder

Current AGL application and

security framework

Binder adds methods to connect applications to secured API

Page 9: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 9

Security model, current design

● The same fundamental as Tizen– Smack + Cynara + Audit

– Signed application

– Permission management

● A new model to use and secure API:– Flexible connection to API

– Token exchange

– Automatic and hiden transport

– Flexible message format

– Debugging and logging features

– Micro service architecture capability

Page 10: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 10

Key components

● Application Manager– One system daemon for application live cycle installs, update, delete

– One user daemon per user for application start, stop, pause, resume

– Create initial share secret between UI and Binder

– Spawn and controls application processes: binder, UI, ...

● Security Manager– Responsible of privilege enforcement

– Based on Cynara + Dbus plugin + WebSocket

● Application & Services Binders– Expose platform APIs to UI, Services, Applications

– Loads services/application plugins : Audio, Canbus, Media Server…

– Private binders per application/services [REST, WebSocket, Dbus]

– Authenticate UI by oAuth token type

– Secured by SMACK label + UID/GIDs

Page 11: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 11

SMACK overview

_

rx rx

wx

rwxSystemUser::App::34FRT3

Inside the kernel, Smack checks all accesses to files, memories, devices or sockets

Any access not authorized is forbidden

Page 12: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 12

Cynara overview

Cynaradatabase

WGT

Cynaradaemon

Applicationinstaller

Installedapplication

ProtectedAPI1. installer

provision permissions

2. cynara records permissions

3. application accesses protected API

4. provider of service checks the access

5. cynara grants or not the access (can ask user consent)

Page 13: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 13

Smack + Cynara

Page 14: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 14

Packaging applications: widgets

Developer team

Configuration fileconfig.xml

1. Developer team produces the application or service

2. Developer team describes its

product and its requirements

Page 15: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 15

Security manifest: config.xml

<?xml version="1.0" encoding="UTF-8"?><widget xmlns="http://www.w3.org/ns/widgets" id="org.openstreetmap.agl.pushviews" version="1.0.1"> <name>Push street views</name> <icon src="pushviews.png"/> <content src="index.html" type="text/html"/> <description>Pushes camera views to openstreetmap</description> <author>Open Street Map</author> <license>GPL</license> <feature name="urn:AGL:widget:required-api"> <param name="gps" value="auto" /> <param name="sensors" value="auto" /> <param name="camera" value="auto" /> <param name="pushviews:https://agl.openstreetmap.org/cloud/pushviews" value="cloud" /> </feature>…

Page 16: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 16

Security manifest: config.xml

… <feature name="urn:AGL:widget:required-permission"> <param name="urn:AGL:permission:gps:public:read" value="required" /> <param name="urn:AGL:permission:sensors:public:read" value="required" /> <param name="urn:AGL:permission:camera:public:take:front" value="required" /> <param name="urn:AGL:permission:camera:public:take:rear" value="optional" /> <param name="urn:AGL:permission::public:HTTP:POST" value="required" /> <param name="urn:AGL:permission::public:HTTP:GET" value="required" /> </feature></widget>

Page 17: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 17

Packaging applications: widgets

Developer team

signed content

3. Developer team signs its product

Page 18: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 18

Packaging applications: widgets

signed content

Authority 1Authority 2

4. Authorities sign the product

Page 19: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 19

Packaging applications: widgets

signed content

WGTWGT

packaged content

5. zip the product, its config and its signatures

Page 20: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 20

Global architecture

Agent-2 Car Environement

Agent-3 Engine

Agent-4 Remote Signal

CAN Bus-A

LIN Bus-A

Audio

CAN Bus-B

Cluster-Unit

...

Smart City

RVI

Cloud

Transport + Acess Control

Navigation Service

Carte handling

POI management

etc...

Log/Supervision Service

Carte handling

POI management

etc...

MultiMedia Service

Media Player

Radio Interface

etc...

Distributed Application Architecture

MAC Enforcement

Smack

Cgroups NameSpace Containers

Application Framwork Live Cycle Management

Sta

rt,S

top

,Pause

,Inst

all,

Rem

ove,...

Page 21: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

What is already in CC ?

Page 22: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 22

The security Framework(implementation of the security model)

Manager part(app-framework-main)

Application management● Install● Uninstall● List● Start● Stop

Binder part(app-framework-binder)

API connection● Unified client protocol

(http, websocket)● Loading and/or

connecting to API● Transparent

connection to remote

Page 23: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 23

Figure of the security framework

1. A service signed by Mitsuko

2. Installed in the system 3. Delivered

to users

4. Loved by users

Page 24: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 24

afb-daemon

Figure of the security framework

afm-system-daemon

WGT

WGT

afm-user-daemon

Security Context

Bindings

application

DB of apps

cryptographiclayered

permissions

WGT

Page 25: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 25

Binder/Binding a mecanism to securely expose API

Security Context Z

Security Context A

User Interface

Binder

Effective API

Binder

local API

Tra

nsp

ort

Lay

er

Security Context S

Binder

Effective API

NETWORK

Other ECU or Cloud

Same ECU

Shadow API

Page 26: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

Ongoing work

Page 27: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 27

Main goals for ALS 2017

✔ Integration with Systemd

✔ Automatic connection to service and API

✔ Identity agent

✔ OpenId connect service

✔ Bugs !

Page 28: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 28

WIP: integration & permission

Integration● Systemd integration● Automatic connection of APIs

Permissions● Definition of permissions● Implementation of cryptographic check of

permission (PKI) at install● Declaring permissions at API level in bindings

Page 29: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 29

WIP: QA & developer & identity

QA & developer● Test framework for QA● More documentation● Hooking events● API for debugging● Integration of packaging within SDK

Identity● User identity handling● OpenId connect service

Page 30: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 30

Integration with systemd

● Replace afm-user-daemon with systemd

● Leverage the power of systemd– Definition of slice hierarchy for predefined Cgroup

– Security-manager launch (user, groups, Smack label, ...)

– Manages API dependencies

– Leverage namespaces (containers)

● Link systemd features with AGL permissions ● Finalize specifications of features of config.xml

Page 31: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 31

config.xml

Integration with systemd

/etc/afm/afm-unit.conf

WGT

WGT

json

Mustacheengine

Unitsdescription

*.service *.socket ...

If permissionvalidated

temporarydata

Unit installer

Page 32: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 32

Definition of permissions

urn:AGL:permission:<api>:<level>:<hierarchical-name>

The API providing (requiring) the permission. If starts with @ then it is a

transversal permission (not linked to an API).

One of the values:— system

— platform— partner

— publisher— owner— public

Colon separated names possibly defining hierarchies of permissions

Proposal:

Advantage: self declaration of api, level and scoping.

Note that other schemes can be defined for being used together with this one.

Page 33: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 33

Cryptographic check of permission

public

partner

platform

system

● PKI model for signing authority● Public keys distribution● Use cryptography to compute

the maximal set of permission for an installed app

● Records and check publisher and owner certificates

● Link file digests with IMA

WGT

WGT

Page 34: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 34

Permissions at API level

● Improves binding API definition– Define permissions by API and by verb

– Enforce security

– Improve compatibility management

● Automatic DBUS security rules● Cynara check for websockets

– Efficient automatic check of permissions

– Enforce security for untrusted softwares

Page 35: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 35

User identity handling

● Default users exist: agl-driver and agl-passenger

● Study the several ways of authenticating users– Key RF

– Phone

– Gesture

– ...

● Provide dynamic allocation of uids for authenticated users● Use uids to ensure privacy of users and Smack for privacy of

applications● Link identity with the Oauth2 service to allow federation

Page 36: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 36

Identity agent

● Provide a service to manage data for the current user in the context

● Provide a service to request an openid connect token for the current context and to refresh associated tokens

● Provide a service that allow the car to be a connect id token provider

Page 37: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 37

Hooking event and debugging

● Add hooks on events● Provide an API to debug applications

– Listen and record events

– Generate events or requests from a debugger

– Provide mock apis

– Introspection

– Compute statistcs

● Provide an API for LOG control– Compatible with DLT spirit

● Link with Open API

Page 38: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 38

Packaging integration in SDK

● Integration of PKI in SDK● CMake & Autoconf features to create widgets● Study how debug & dev can be provided

– On a real target

– On an emulator

– Within common IDE (eclipse)

Page 39: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 39

Future Work● Update to new version of libmicrohttpd● Optimisation of json performance● Add new transport as Bus1● Bindings in javascript● Secured websockets● Integration of Open API for docs and tests● Management of services● Helper library to speed up bindings developement● Container instanciation within systemd● Study new WS protocol (optimisation of the current one, use

of binary data like CBOR or BJSON)

Page 40: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 40

Agenda

● For ALS 2017 (31 may)– Integration with Systemd

– Automatic connection to service and API

– Identity agent

– OpenId connect service

● For AMM winter 2017 (oct)– QA and tests

– Logging + hooking + debugging + statistics

● For CES 2018 (january 2018)– Cryptographic check of levels of permissions

Page 41: AGL security framework review - iot.bzhiot.bzh/download/public/2017/AMMQ1Tokyo/AGL-security-framewor… · review José Bollo jose.bollo@iot.bzh. History & high level goals. February

February 9th, 2017 AGL AMM, Tokyo, AGL Security framework review 41

Too late for prevention

Questions