- Configuration management - Cfengine architecture ... -...

27
Cfengine presentation - Configuration management - Promise technology - Cfengine architecture - Cfengine syntax - Examples

Transcript of - Configuration management - Cfengine architecture ... -...

Page 1: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

Cfengine presentation

- Configuration management

- Promise technology

- Cfengine architecture

- Cfengine syntax

- Examples

Page 2: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 2

About the speaker

Nicolas CHARLES : [email protected]

Developer in different languages and fields for the past

7 years

2009, cofounded Normation

Active member of the Cfengine community

Normation

Software company

Compliance and Drift assessment

Cfengine partner

Consulting on Identity and Service Management

Page 3: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 3

Why should I manage configurations?

Page 4: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 4

Why should I manage configurations ? Automation and normalisation

Centralized entry point for configurations, Automated operations on each servers, Test configuration on a separate environnement and

automate its deployement on servers.

Keep a track of what has been done Use a source control for configuration files, Rollback on configuration files in case of error, Self healing configuration from a defined reference.

Page 5: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 5

Some Cfengine users Long track-record with millions servers managed

by thousands registered users including:

Page 6: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 6

Promise Technology

Based on Promise Theory

Goals are invariants

Recipes depend on circumstances

Simple connection to « Service Level

Agreements »

Promise that an Apache server is up and running

A promise is a documentation by itself

Page 7: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 7

Convergence Promises focus on the desired state

Convergence is built in Cfengine

Cfengine way Traditional scripts

Page 8: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 8

Cfengine features

Page 9: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 9

Cfengine architecture

Cfengine can be used as a standalone agent No need to be connected to an external system, Use its own promises (or fetch them from a source

control)

Your whole infrastructure can be managed by Cfengine Centralize the configuration of promises, Use policy servers to distribute promises files to agents.

Page 10: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 10

Cfengine architecture

Page 11: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 11

Cfengine architecture

Each node is responsible for its own state

High scalability

Resilient to network outage

Agents use external resources on demand Fetch policies updates from policy server

Package management integration

LDAP and Database integration*

Page 12: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 12

Cfengine components

7 components : cf-promises : syntax checker, cf-agent : the cfengine agent, cf-served : server for file sharing and external

request, cf-execd : scheduling daemon, cf-runagent : helper program that talks to cf-served, cf-report : generate reports on executions, cf-know : generate topic map.

Page 13: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 13

Cfengine components

Execution flows

Page 14: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 14

Cfengine agent

Agent installed on each server

Written in C

Cross platform (Linux, Unixes, *BSD, Windows,

MacOS)

Few external dependencies (OpenSSL, [PCRE])

Very small memory footprint (between 2 and 30

MB)

Page 15: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 15

Cfengine agent

Aware of the computer's configuration

Autonomous

Automated

Continuous operation

Reliable : only one vulnerability in 17 years

Page 16: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 16

Installation

Installation packages available for :

CentOS

Debian

Fedora

FreeBSD*

RedHat

Solaris*

SUSE

Ubuntu

Windows*

Page 17: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 17

Installation

Typical installation path /var/cfengine : base folder for cfengine /var/cfengine/bin : cfengine components /var/cfengine/inputs : promises files /var/cfengine/ppkeys : private keys /var/cfengine/outputs : outputs of each runs And some others....

Page 18: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 18

Generic promise syntax

type:

 class::

  "promiser" ­> { "promisee1", "promisee2" },

     attribute_1 => body_or_template1,

     attribute_2 => body_or_template2;

Page 19: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 19

Generic promise syntax Cfengine promises are made of bundle ( similar to

a function ) Each bundle can contain several instructions.

The entry point for cf-agent is the body common control Define the list and order of execution of the bundles Define the imported files

Page 20: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 20

Hello World

body common control {

  bundlesequence => { "test" } ;

 }

 bundle agent test {

  reports:

    linux::

     "Hello World !" ;

 }

Page 21: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 21

Generic promise syntaxTypes :

vars classes interfaces processes storage packages commands methods files databases* services* reports

Page 22: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 22

Use library

body common control { bundlesequence => { "packages" }; inputs => {"cfengine_stdlib.cf"}; }

bundle agent packages { vars: "match_package" slist => { "apache2-mod_php5", "apache2-prefork", "php5" }; packages: "$(match_package)" package_policy => "add", package_method => apt; }

Page 23: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 23

Examples

Page 24: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 24

A word of caution

 body common control {

  bundlesequence => { "killall" };

 }

 bundle agent killall {

  processes:

".*"

   signals => { "kill" };

 }

Page 25: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 25

Acknowledgements

Mark Burgess

Wrote Cfengine

Borrowed heavily from his work :

Cfengine Reborn, Paris, 2009 http://www.slideshare.net/normation/cfengine-reborn

http://cfengine.com/pages/demos

RMLL

Thank you for this conference

Page 26: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 26

Want more ?

http://www.cfengine.org/

https://cfengine.com/forum/

Mailing-list : [email protected]

IRC : freenode #cfengine

Email : [email protected]

Page 27: - Configuration management - Cfengine architecture ... - RMLL2010.rmll.info/IMG/pdf/RMLL2010-AdminSys-Cfengine.pdf · Cfengine architecture Cfengine can be used as a standalone agent

© Normation 2010 -  Tous droits réservés – Document strictement confidentiel.Il ne peut être utilisé, reproduit ou divulgué sans autorisation écrite préalable. 27

Q&AThank you for your attention !