Slide 1

Slide 1 text

CFEngine on Android

Slide 2

Slide 2 text

Summary Conf Management for Android? CFEngine / Rudder 03 04 01 Android? 02 Android != GNU/Linux

Slide 3

Slide 3 text

Android ? 01

Slide 4

Slide 4 text

Android ? I suppose you already know android :-) You find it in many Consumer devices like phone and tablet. OS made by Google, opensource (Apache Licence) Many manufacturers: build devices and customize the OS Google make sure that devices are “compatible” (CTS) Do you need configuration tools for your pocket device?

Slide 5

Slide 5 text

People bring their own devices at work (or work devices at home) Access to corporate network resources, contains sensitive data. => need to apply security policy Localisation / wipe Tracking / inventory Bring Your Own Device BYOD Android ?

Slide 6

Slide 6 text

Android is used on every kind of devices. eg: bus shelter at Paris. 3 Android screens, interactive application for the city (tourist info, find shop at 11pm, ...) Those devices are connected by ethernet, static ip, UPS, … => not mobile but more like server => Need to update the software, change configuration (ssh keys, fix bug in libssl, ...) Mobile Devices NOT Android ?

Slide 7

Slide 7 text

Android is found on many type of embedded devices. Google has bought Nest => android on Internet of Things => security issue, how to update and patch those devices? Fridge sending spam (http://www.bbc.co.uk/news/technology- 25780908) Bruce schneier wrote an essay to explain that embedded devices are often shipped with old open source packages and no way for the user to update them. https://www.schneier.com/essay-468.html Internet of Things Android ?

Slide 8

Slide 8 text

NEED CONFIGURATION MANAGEMENT Android ?

Slide 9

Slide 9 text

A bit of background story At genymobile, we build customized android version of professional usage (eg: bus shelter, professional tablet) We took the source code from google (AOSP) and customize it and add / remove feature (ethernet support, proxy, snmp), be able to run a (legacy) binary as root, improve security, …. I am a software engineer not a sysadmin :-) Customer ask us how to manage the rom we provided, no real solution out of the box How hard it can be? Android is just another linux, just install your favorite configuration management tool Add features AOSP Dev Ops? Management? Customize Genymobile Android ? Genymobile Story

Slide 10

Slide 10 text

Android is not GNU/Linux 02

Slide 11

Slide 11 text

How android is different? Let see (quickly) : * Linux kernel (patched) * libc: bionic, not fully posix. * Many opensource componant: sqlite, ssl, webkit, … * Some are google made: X11 => surfaceflinger, gstreamer => Mediaframework * can run binaries but all the OS / Framework is written in java: API oriented with configuration stored in sqlite db ex: change keyboard layout * Gnu/Linux: edit xorg.conf /restart X * Android: API call, sqlite store + framework send messages to all applications Android is not Gnu / Linux Android Challenge

Slide 12

Slide 12 text

Not FHS ! In data an application can only see its own folder Android is not Gnu / Linux Android Challenge un-partitioned => kernel, ramfs (contains /) / => initscript + conf, cannot be modified /system => RO, can be remounted RW (need root access) /bin => daemon + toolbox (less than busybox) /lib => libssl.so, libsqlite.so /framework => *.jar /data => RW, application data + user configuration, accounts, … (need root) /data/data/myapp => user application File System

Slide 13

Slide 13 text

No package management for the system (you cannot update a lib) PM is for application only (playstore) To update the OS you need to use OTA: * download a zip file with the new OS or a binary patch * reboot in recovery mode, flash the zip * reboot with the new system Android is not Gnu / Linux Android Challenge

Slide 14

Slide 14 text

No python, no ruby (at least not easy) Mobile devices: no much ram, need to take care of cpu usage => battery Limit the choice of tools HAVE NOT -:( Android is not Gnu / Linux Android Challenge

Slide 15

Slide 15 text

We can do native C or java with limitation (not posix, …) CHOICE :-) Android is not Gnu / Linux Android Challenge

Slide 16

Slide 16 text

What exists? Conf Management for Android 03

Slide 17

Slide 17 text

Google is targeted to “mass market”. Make money with ads, playstore, and android drive user to google products No enterprise offers (!=RIM) Android has a Device Administrator API. If you set an app to be you Device Administrator, it can do the following http://developer.android.com/guide/topics/admin/device-admin.html Password Management Conf Management for Android Google: Device Administrator API Remote Wipe Force Encryption

Slide 18

Slide 18 text

Some manufacturer have private API to manage their device => buy the phone AND the MDM solution => classic tied Other use various hack + user help (popup if a forbidden app is installed) Private API Conf Management for Android Manufacturer / Solution provider Hack

Slide 19

Slide 19 text

Can we do better with CFEngine CFEngine + Rudder 04

Slide 20

Slide 20 text

Native code: light, efficient, written in C => good match for Android Need to solve some compilation issue Add support for android (android::) + techniques ⇒ patch sent upstream (or in progress) Native code CFEngine + Rudder CFEngine Porting patches Android Support

Slide 21

Slide 21 text

CFEngine: native daemon, run in the linux / shell land Configuration: managed by android in the java land CFEngine + Rudder CFEngine

Slide 22

Slide 22 text

Jni: C code that call java function Java helper: launch java “command line tool” from linux (see command am on android) Rom helper: CFEngine + Rudder CFEngine JNI Java Helper Rom Helper

Slide 23

Slide 23 text

Create your own Android version: * permission: need to run as root. Can root the device and install sudo to launch cfengine, not a clean solution Write your rom and create a clean daemon launched in the init script * management: Android state can be exported as files and CFEngine is good at managing files. Solve the communication issue (eg package whitelist / blacklist) * Add the feature you need and let cfengine manage it (eg: proxy) Can be scary, but is the only way to master your device: your are free to update it and push security fix if needed. Use The ROM! CFEngine + Rudder ROM

Slide 24

Slide 24 text

User Friendly CFEngine + Rudder Rudder Inventory Reporting

Slide 25

Slide 25 text

You have two part in rudder, the server is a web interface to manage all the nodes. The client is cfengine + techniques + inventory agent: fusionInventory or OCSInventory When an agent start, it send a inventory to the server. Then you can search for agents based on the inventory (hostname, mac, operating system, processor type, …) The search result can be used to create groups of nodes. CFEngine + Rudder Rudder

Slide 26

Slide 26 text

Create a directive: ie a “configuration element”. For example, this directive make sure your node use the version 42 of the Android operating system. Directive template are created in order to be easy to use: here you select only the version number, the server name, and the time to update. A non expert operator can easily use the directive and change some parameters. The role of the expert team is to create the directive (in cfengine3 language) CFEngine + Rudder Rudder

Slide 27

Slide 27 text

Finally you apply directives to groups of node. “I want every Android devices from this group to be in this version of the system” You can check the compliance: if your devices are responding to the directive. CFEngine + Rudder Rudder

Slide 28

Slide 28 text

os behaviour: add a proxy, bring up vpn with geo data, …. OTA Update Package Management Blacklist Geofencing Remote Wipe Policy enforcement os behaviour Features CFEngine + Rudder

Slide 29

Slide 29 text

* cfengine is portable * you can build it with your rom * help you to manage your android with your features Thank You for your time ! Questions ? Email: [email protected] G+: https://www.google.com/+CedricCabessa Slides: https://speakerdeck.com/cedriccabessa/cfengine-android Cédric Cabessa

Slide 30

Slide 30 text

CFEngine on Android

Slide 31

Slide 31 text

Summary Conf Management for Android? CFEngine / Rudder 03 04 01 Android? 02 Android != GNU/Linux

Slide 32

Slide 32 text

Android ? 01

Slide 33

Slide 33 text

Android ?

Slide 34

Slide 34 text

Bring Your Own Device BYOD Android ?

Slide 35

Slide 35 text

Mobile Devices NOT Android ?

Slide 36

Slide 36 text

Internet of Things Android ?

Slide 37

Slide 37 text

NEED CONFIGURATION MANAGEMENT Android ?

Slide 38

Slide 38 text

Add features AOSP Dev Ops? Management? Customize Genymobile Android ? Genymobile Story

Slide 39

Slide 39 text

Android is not GNU/Linux 02

Slide 40

Slide 40 text

Android is not Gnu / Linux Android Challenge

Slide 41

Slide 41 text

Android is not Gnu / Linux Android Challenge un-partitioned => kernel, ramfs (contains /) / => initscript + conf, cannot be modified /system => RO, can be remounted RW (need root access) /bin => daemon + toolbox (less than busybox) /lib => libssl.so, libsqlite.so /framework => *.jar /data => RW, application data + user configuration, accounts, … (need root) /data/data/myapp => user application File System

Slide 42

Slide 42 text

Android is not Gnu / Linux Android Challenge

Slide 43

Slide 43 text

HAVE NOT -:( Android is not Gnu / Linux Android Challenge

Slide 44

Slide 44 text

CHOICE :-) Android is not Gnu / Linux Android Challenge

Slide 45

Slide 45 text

Conf Management for Android 03

Slide 46

Slide 46 text

Password Management Conf Management for Android Google: Device Administrator API Remote Wipe Force Encryption

Slide 47

Slide 47 text

Private API Conf Management for Android Manufacturer / Solution provider Hack

Slide 48

Slide 48 text

CFEngine + Rudder 04

Slide 49

Slide 49 text

Native code CFEngine + Rudder CFEngine Porting patches Android Support

Slide 50

Slide 50 text

CFEngine + Rudder CFEngine

Slide 51

Slide 51 text

CFEngine + Rudder CFEngine JNI Java Helper Rom Helper

Slide 52

Slide 52 text

Use The ROM! CFEngine + Rudder ROM

Slide 53

Slide 53 text

User Friendly CFEngine + Rudder Rudder Inventory Reporting

Slide 54

Slide 54 text

CFEngine + Rudder Rudder

Slide 55

Slide 55 text

CFEngine + Rudder Rudder

Slide 56

Slide 56 text

CFEngine + Rudder Rudder

Slide 57

Slide 57 text

OTA Update Package Management Blacklist Geofencing Remote Wipe Policy enforcement os behaviour Features CFEngine + Rudder

Slide 58

Slide 58 text

Thank You for your time ! Questions ? Email: [email protected] G+: https://www.google.com/+CedricCabessa Slides: https://speakerdeck.com/cedriccabessa/cfengine-android Cédric Cabessa