SlideShare a Scribd company logo
1 of 33
Configuration management
Why? What? How?
Why?
● example:
○ imagine that we want to prevent root
logins on 100 nodes
Why?
● example:
○ imagine that we want to prevent root
logins on 100 nodes
○ we want to set PermitRootLogin option
in sshd_config to "no"
Why?
● example:
○ imagine that we want to prevent root
logins on 100 nodes
○ we want to set PermitRootLogin option
in sshd_config to "no"
○ we have to execute this command on
every node:
echo "PermitRootLogin no" >>
/etc/ssh/sshd_config
for node in node{1..100};do ssh
root@$node "echo "PermitRootLogin
no" >> /etc/ssh/sshd_config"
;done
● bug: string will be appended
every time we run this for cycle
○ no problem, we gonna fix it
for node in node{1..100};do ssh
root@$node "(grep -iq
'PermitRootLogin'
/etc/ssh/sshd_config || echo "
PermitRootLogin no" >>
/etc/ssh/sshd_config) && sed -i
's/^.*PermitRootLogin.
*$/PermitRootLogin no/;'
/etc/sshd_config"
;done
● it's complicated, i'll put it
into script
What if?
● option is already set to "no"
What if?
● option is already set to "no"
● option is commented out
What if?
● option is already set to "no"
● option is commented out
● sshd_config does not exist on
specified path
What if?
● option is already set to "no"
● option is commented out
● sshd_config does not exist on
specified path
● sshd is not installed at all
What if?
● option is already set to "no"
● option is commented out
● sshd_config does not exist on
specified path
● sshd is not installed at all
● operation fails on node 2,4,9,31
and 83 (wrong permissions?)
What if?
● option is already set to "no"
● option is commented out
● sshd_config does not exist on
specified path
● sshd is not installed at all
● operation fails on node 2,4,9,31
and 83 (wrong permissions?)
● node 70 and 71 is openindiana
What if?
● option is already set to "no"
● option is commented out
● sshd_config does not exist on
specified path
● sshd is not installed at all
● operation fails on node 2,4,9,31
and 83 (wrong permissions?)
● node 70 and 71 is openindiana
● sshd fails to restart on node
19,21
What if?
● option is already set to "no"
● option is commented out
● sshd_config does not exist on
specified path
● sshd is not installed at all
● operation fails on node 2,4,9,31
and 83 (wrong permissions?)
● node 70 and 71 is openindiana
● sshd fails to restart on node
19,21
● node 13 is in maintenance
Script
● would be too complicated
○ different operation systems and flavors
○ handling all situations
● can't handle offline nodes
● hard to maintain
● hard to use
● human error is inevitable
complex processeses or orchestration through
the for cycle is
NO GO
What is configuration management
good for ?
● can handle a lot of details
● handling deviation from defined configuration
○ accidentally removed packages,files,configuration by
hand...
○ would return system to original state
● infrastructure configuration as a code
○ code is repeatable
○ using VCS (git,svn,hg,...) you may create
environment for change management
● change deployment
○ in controled manner
● automatic server deployment
○ new server is deployed using existing code
"I don't need to use it"
● do it, you won't regret it
○ even on your computer alone
○ or with few servers
How?
● there are a lot of tools available:
○ Puppet
○ Chef
○ Bcfg2
○ CFEngine3
○ Salt
○ Ansible
○ ...and others
● choose the right tool for your needs
CFEngine 3
Tomas Corej
@tomas_corej
History of CM tools
src: http://bit.ly/acuidi
CFEngine
● developed in 1993 by @markburgess_osl
○ also created whole field
● CFEngine 1
○ domain-specific language
● CFEngine 2 (1998)
○ idea of convergence
■ tool discover state of system
● CFEngine 3 (2009)
○ complete rewrite
○ based on Promise Theory developed by Mark
Burgess
CFEngine 3
● written in C
● strong theoretical background
○ it should be same for years
● cross platform
○ Linux,*BSD,Solaris,Windows....
○ from Rasberry Pi to big IT deployments (Facebook)
● small footprint
○ small cpu usage - http://bit.ly/QJcrg8
● very scalable
○ can handle hundreds of thousands servers
○ policy hierarchy
● zero reported vulnerabilities
CFEngine 3 design principles
● desired-state configuration
○ declarative policy language
○ you only specify your desired final state of system
○ CFEngine will handle everything else automatically
○ but if operation is not native, you have to tell
CFEngine "how"
● promise theory
○ models behaviour of agents in an environment
without central authority
○ voluntary cooperation
● convergent configuration
○ you don't need know current state of system
○ convergence in incremental steps
Architecture
src: cfengine.com
Architecture
● no clear distinction between agent (client)
and policy hub (server)
● every agent can be policy hub for another
set of agents
● agents updates policy files from hub
○ if policy hub is unreachable => policy files are not
updated
○ every 5 minutes
○ no other mechanism to tell agents what to do
Show me the code!
bundle agent sshd_norootlogin
{
files:
"/etc/ssh/sshd_config"
edit_line =>
replace_or_add(".*PermitRootLogin.*",
"PermitRootLogin no");
}
Code
● covers many situations:
○ commented option
○ non-exist option
○ option set to other value than "no"
● how to handle various environments ?
○ using context
○ they're known also as the classes but their meaning
is not the same as in OOP
Context
● as a conditionals to handle different
environments or state
○ does a file exist ? is pkg installed ? yes/no
○ is this system debian,ubuntu or windows?
○ is this system with hostname matching web* ?
● hard classes
○ discovered by cfengine
○ hostname, ip addresses, interfaces...
● soft classes
○ classes defined during runtime
code++
bundle agent sshd_norootlogin
{
vars:
debian::
"sshdconf" string => "/etc/ssh/sshd_config";
!debian::
"sshdconf" string => "/usr/local/etc/ssh/sshd_config";
files:
"$(sshdconf)"
edit_line =>
replace_or_add(".*PermitRootLogin.*",
"PermitRootLogin no");
}
Who am I and why CFEngine
● sysadmin @ Websupport.sk
● the biggest webhosting provider in Slovakia
● tens thousands of services (domains,vps,
hostings)
● we're going to move all of them to new
hardware infrastructure in few months
● we choosed CFEngine3 because of it
features:
The features that works for us
● strong theoretical background
○ where will be Puppet and Chef when hype ends ?
● small CPU and memory overhead
● scalability
○ we may need to handle 1000-2000 virtual servers
● model based monitoring http://bit.ly/Vle8zc
○ CFEngine can be used as a monitoring tool or as a
addon to other monitoring tool
○ monitoring is self-learning => no need to setup
anything
○ learns state of system for past 7 days
○ if metric value is larger than standard deviation =>
something unusual is happening
Features that works for us
● knowledge maps
○ you may generate logical maps of subsystems from
code
● is not written in ruby :)
○ we have strong experience with C
Questions ?

More Related Content

What's hot

Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...
Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...
Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...Puppet
 
Node.js for Rubists
Node.js for RubistsNode.js for Rubists
Node.js for RubistsSagiv Ofek
 
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishMagento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishYireo
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterKenny (netman)
 
Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012Walter Heck
 
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...Stacey Whitney
 
Grand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-CGrand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-CPavel Albitsky
 
What is new in Go 1.8
What is new in Go 1.8What is new in Go 1.8
What is new in Go 1.8John Hua
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxKenny (netman)
 
Building a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchBuilding a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchGoran Cetusic
 
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012Walter Heck
 
Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...
Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...
Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...Puppet
 
Don’t block the event loop!
Don’t block the event loop!Don’t block the event loop!
Don’t block the event loop!hujinpu
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernelJohnson Chou
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptKenny (netman)
 

What's hot (19)

Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...
Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...
Puppet Camp NYC 2014: Safely storing secrets and credentials in Git for use b...
 
Node.js for Rubists
Node.js for RubistsNode.js for Rubists
Node.js for Rubists
 
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and VarnishMagento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
Magento 2 Seminar - Miguel Balparda - M2 with PHP 7 and Varnish
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filter
 
Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012Puppet User Group Presentation - 15 March 2012
Puppet User Group Presentation - 15 March 2012
 
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
Mage Titans USA 2016 - Miguel Balparda - Magento 2: Premium Performance with ...
 
Thread safety
Thread safetyThread safety
Thread safety
 
Grand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-CGrand Central Dispatch in Objective-C
Grand Central Dispatch in Objective-C
 
Virtual domains
Virtual domainsVirtual domains
Virtual domains
 
What is new in Go 1.8
What is new in Go 1.8What is new in Go 1.8
What is new in Go 1.8
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
 
Building a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchBuilding a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitch
 
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012
 
Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...
Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...
Puppet Camp Boston 2014: Securely Managing Secrets with FreeIPA and Puppet (I...
 
Ssh cookbook
Ssh cookbookSsh cookbook
Ssh cookbook
 
Don’t block the event loop!
Don’t block the event loop!Don’t block the event loop!
Don’t block the event loop!
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernel
 
ssh
sshssh
ssh
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 

Similar to Tomáš Čorej: Configuration management & CFEngine3

Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Docker, Inc.
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013dotCloud
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...Yandex
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment Systema3sec
 
Introduction to Docker (as presented at December 2013 Global Hackathon)
Introduction to Docker (as presented at December 2013 Global Hackathon)Introduction to Docker (as presented at December 2013 Global Hackathon)
Introduction to Docker (as presented at December 2013 Global Hackathon)Jérôme Petazzoni
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveAlison Chaiken
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyOlivier Bourgeois
 
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQDocker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQJérôme Petazzoni
 
Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9 Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9 Jérôme Petazzoni
 
Introduction to Docker and Containers
Introduction to Docker and ContainersIntroduction to Docker and Containers
Introduction to Docker and ContainersDocker, Inc.
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesPuppet
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakNETWAYS
 
Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Anthony Wong
 
We shall play a game....
We shall play a game....We shall play a game....
We shall play a game....Sadia Textile
 
Shall we play a game
Shall we play a gameShall we play a game
Shall we play a gamejackpot201
 
Designate Install and Operate Workshop
Designate Install and Operate WorkshopDesignate Install and Operate Workshop
Designate Install and Operate WorkshopGraham Hayes
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactAlessandro Selli
 

Similar to Tomáš Čorej: Configuration management & CFEngine3 (20)

Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
 
A3Sec Advanced Deployment System
A3Sec Advanced Deployment SystemA3Sec Advanced Deployment System
A3Sec Advanced Deployment System
 
Introduction to Docker (as presented at December 2013 Global Hackathon)
Introduction to Docker (as presented at December 2013 Global Hackathon)Introduction to Docker (as presented at December 2013 Global Hackathon)
Introduction to Docker (as presented at December 2013 Global Hackathon)
 
Adhocr T-dose 2012
Adhocr T-dose 2012Adhocr T-dose 2012
Adhocr T-dose 2012
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to love
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
 
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQDocker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
 
Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9 Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9
 
Introduction to Docker and Containers
Introduction to Docker and ContainersIntroduction to Docker and Containers
Introduction to Docker and Containers
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large Enterprises
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
 
Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势Linux 开源操作系统发展新趋势
Linux 开源操作系统发展新趋势
 
We shall play a game....
We shall play a game....We shall play a game....
We shall play a game....
 
Shall we play a game
Shall we play a gameShall we play a game
Shall we play a game
 
Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?
 
0507 057 01 98 * Adana Klima Servisleri
0507 057 01 98 * Adana Klima Servisleri0507 057 01 98 * Adana Klima Servisleri
0507 057 01 98 * Adana Klima Servisleri
 
Designate Install and Operate Workshop
Designate Install and Operate WorkshopDesignate Install and Operate Workshop
Designate Install and Operate Workshop
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
 

More from Jano Suchal

Slovensko.Digital: Čo ďalej?
Slovensko.Digital: Čo ďalej?Slovensko.Digital: Čo ďalej?
Slovensko.Digital: Čo ďalej?Jano Suchal
 
Improving code quality
Improving code qualityImproving code quality
Improving code qualityJano Suchal
 
Beyond search queries
Beyond search queriesBeyond search queries
Beyond search queriesJano Suchal
 
Rank all the things!
Rank all the things!Rank all the things!
Rank all the things!Jano Suchal
 
Rank all the (geo) things!
Rank all the (geo) things!Rank all the (geo) things!
Rank all the (geo) things!Jano Suchal
 
Ako si vybrať programovácí jazyk alebo framework?
Ako si vybrať programovácí jazyk alebo framework?Ako si vybrať programovácí jazyk alebo framework?
Ako si vybrať programovácí jazyk alebo framework?Jano Suchal
 
Bonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet WorkshopBonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet WorkshopJano Suchal
 
Peter Mihalik: Puppet
Peter Mihalik: PuppetPeter Mihalik: Puppet
Peter Mihalik: PuppetJano Suchal
 
Ako si vybrať programovací jazyk a framework?
Ako si vybrať programovací jazyk a framework?Ako si vybrať programovací jazyk a framework?
Ako si vybrať programovací jazyk a framework?Jano Suchal
 
SQL: Query optimization in practice
SQL: Query optimization in practiceSQL: Query optimization in practice
SQL: Query optimization in practiceJano Suchal
 
Garelic: Google Analytics as App Performance monitoring
Garelic: Google Analytics as App Performance monitoringGarelic: Google Analytics as App Performance monitoring
Garelic: Google Analytics as App Performance monitoringJano Suchal
 
Miroslav Šimulčík: Temporálne databázy
Miroslav Šimulčík: Temporálne databázyMiroslav Šimulčík: Temporálne databázy
Miroslav Šimulčík: Temporálne databázyJano Suchal
 
Vojtech Rinik: Internship v USA - moje skúsenosti
Vojtech Rinik: Internship v USA - moje skúsenostiVojtech Rinik: Internship v USA - moje skúsenosti
Vojtech Rinik: Internship v USA - moje skúsenostiJano Suchal
 
Profiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applicationsProfiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applicationsJano Suchal
 
Aký programovací jazyk a framework si vybrať a prečo?
Aký programovací jazyk a framework si vybrať a prečo?Aký programovací jazyk a framework si vybrať a prečo?
Aký programovací jazyk a framework si vybrať a prečo?Jano Suchal
 
Petr Joachim: Redis na Super.cz
Petr Joachim: Redis na Super.czPetr Joachim: Redis na Super.cz
Petr Joachim: Redis na Super.czJano Suchal
 
Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1Jano Suchal
 
PostgreSQL: Advanced features in practice
PostgreSQL: Advanced features in practicePostgreSQL: Advanced features in practice
PostgreSQL: Advanced features in practiceJano Suchal
 

More from Jano Suchal (20)

Slovensko.Digital: Čo ďalej?
Slovensko.Digital: Čo ďalej?Slovensko.Digital: Čo ďalej?
Slovensko.Digital: Čo ďalej?
 
Datanest 3.0
Datanest 3.0Datanest 3.0
Datanest 3.0
 
Improving code quality
Improving code qualityImproving code quality
Improving code quality
 
Beyond search queries
Beyond search queriesBeyond search queries
Beyond search queries
 
Rank all the things!
Rank all the things!Rank all the things!
Rank all the things!
 
Rank all the (geo) things!
Rank all the (geo) things!Rank all the (geo) things!
Rank all the (geo) things!
 
Ako si vybrať programovácí jazyk alebo framework?
Ako si vybrať programovácí jazyk alebo framework?Ako si vybrať programovácí jazyk alebo framework?
Ako si vybrať programovácí jazyk alebo framework?
 
Bonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet WorkshopBonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet Workshop
 
Peter Mihalik: Puppet
Peter Mihalik: PuppetPeter Mihalik: Puppet
Peter Mihalik: Puppet
 
Ako si vybrať programovací jazyk a framework?
Ako si vybrať programovací jazyk a framework?Ako si vybrať programovací jazyk a framework?
Ako si vybrať programovací jazyk a framework?
 
SQL: Query optimization in practice
SQL: Query optimization in practiceSQL: Query optimization in practice
SQL: Query optimization in practice
 
Garelic: Google Analytics as App Performance monitoring
Garelic: Google Analytics as App Performance monitoringGarelic: Google Analytics as App Performance monitoring
Garelic: Google Analytics as App Performance monitoring
 
Miroslav Šimulčík: Temporálne databázy
Miroslav Šimulčík: Temporálne databázyMiroslav Šimulčík: Temporálne databázy
Miroslav Šimulčík: Temporálne databázy
 
Vojtech Rinik: Internship v USA - moje skúsenosti
Vojtech Rinik: Internship v USA - moje skúsenostiVojtech Rinik: Internship v USA - moje skúsenosti
Vojtech Rinik: Internship v USA - moje skúsenosti
 
Profiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applicationsProfiling and monitoring ruby & rails applications
Profiling and monitoring ruby & rails applications
 
Aký programovací jazyk a framework si vybrať a prečo?
Aký programovací jazyk a framework si vybrať a prečo?Aký programovací jazyk a framework si vybrať a prečo?
Aký programovací jazyk a framework si vybrať a prečo?
 
Čo po GAMČI?
Čo po GAMČI?Čo po GAMČI?
Čo po GAMČI?
 
Petr Joachim: Redis na Super.cz
Petr Joachim: Redis na Super.czPetr Joachim: Redis na Super.cz
Petr Joachim: Redis na Super.cz
 
Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1
 
PostgreSQL: Advanced features in practice
PostgreSQL: Advanced features in practicePostgreSQL: Advanced features in practice
PostgreSQL: Advanced features in practice
 

Recently uploaded

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Tomáš Čorej: Configuration management & CFEngine3

  • 2. Why? ● example: ○ imagine that we want to prevent root logins on 100 nodes
  • 3. Why? ● example: ○ imagine that we want to prevent root logins on 100 nodes ○ we want to set PermitRootLogin option in sshd_config to "no"
  • 4. Why? ● example: ○ imagine that we want to prevent root logins on 100 nodes ○ we want to set PermitRootLogin option in sshd_config to "no" ○ we have to execute this command on every node: echo "PermitRootLogin no" >> /etc/ssh/sshd_config
  • 5. for node in node{1..100};do ssh root@$node "echo "PermitRootLogin no" >> /etc/ssh/sshd_config" ;done ● bug: string will be appended every time we run this for cycle ○ no problem, we gonna fix it
  • 6. for node in node{1..100};do ssh root@$node "(grep -iq 'PermitRootLogin' /etc/ssh/sshd_config || echo " PermitRootLogin no" >> /etc/ssh/sshd_config) && sed -i 's/^.*PermitRootLogin. *$/PermitRootLogin no/;' /etc/sshd_config" ;done ● it's complicated, i'll put it into script
  • 7. What if? ● option is already set to "no"
  • 8. What if? ● option is already set to "no" ● option is commented out
  • 9. What if? ● option is already set to "no" ● option is commented out ● sshd_config does not exist on specified path
  • 10. What if? ● option is already set to "no" ● option is commented out ● sshd_config does not exist on specified path ● sshd is not installed at all
  • 11. What if? ● option is already set to "no" ● option is commented out ● sshd_config does not exist on specified path ● sshd is not installed at all ● operation fails on node 2,4,9,31 and 83 (wrong permissions?)
  • 12. What if? ● option is already set to "no" ● option is commented out ● sshd_config does not exist on specified path ● sshd is not installed at all ● operation fails on node 2,4,9,31 and 83 (wrong permissions?) ● node 70 and 71 is openindiana
  • 13. What if? ● option is already set to "no" ● option is commented out ● sshd_config does not exist on specified path ● sshd is not installed at all ● operation fails on node 2,4,9,31 and 83 (wrong permissions?) ● node 70 and 71 is openindiana ● sshd fails to restart on node 19,21
  • 14. What if? ● option is already set to "no" ● option is commented out ● sshd_config does not exist on specified path ● sshd is not installed at all ● operation fails on node 2,4,9,31 and 83 (wrong permissions?) ● node 70 and 71 is openindiana ● sshd fails to restart on node 19,21 ● node 13 is in maintenance
  • 15. Script ● would be too complicated ○ different operation systems and flavors ○ handling all situations ● can't handle offline nodes ● hard to maintain ● hard to use ● human error is inevitable complex processeses or orchestration through the for cycle is NO GO
  • 16. What is configuration management good for ? ● can handle a lot of details ● handling deviation from defined configuration ○ accidentally removed packages,files,configuration by hand... ○ would return system to original state ● infrastructure configuration as a code ○ code is repeatable ○ using VCS (git,svn,hg,...) you may create environment for change management ● change deployment ○ in controled manner ● automatic server deployment ○ new server is deployed using existing code
  • 17. "I don't need to use it" ● do it, you won't regret it ○ even on your computer alone ○ or with few servers
  • 18. How? ● there are a lot of tools available: ○ Puppet ○ Chef ○ Bcfg2 ○ CFEngine3 ○ Salt ○ Ansible ○ ...and others ● choose the right tool for your needs
  • 20. History of CM tools src: http://bit.ly/acuidi
  • 21. CFEngine ● developed in 1993 by @markburgess_osl ○ also created whole field ● CFEngine 1 ○ domain-specific language ● CFEngine 2 (1998) ○ idea of convergence ■ tool discover state of system ● CFEngine 3 (2009) ○ complete rewrite ○ based on Promise Theory developed by Mark Burgess
  • 22. CFEngine 3 ● written in C ● strong theoretical background ○ it should be same for years ● cross platform ○ Linux,*BSD,Solaris,Windows.... ○ from Rasberry Pi to big IT deployments (Facebook) ● small footprint ○ small cpu usage - http://bit.ly/QJcrg8 ● very scalable ○ can handle hundreds of thousands servers ○ policy hierarchy ● zero reported vulnerabilities
  • 23. CFEngine 3 design principles ● desired-state configuration ○ declarative policy language ○ you only specify your desired final state of system ○ CFEngine will handle everything else automatically ○ but if operation is not native, you have to tell CFEngine "how" ● promise theory ○ models behaviour of agents in an environment without central authority ○ voluntary cooperation ● convergent configuration ○ you don't need know current state of system ○ convergence in incremental steps
  • 25. Architecture ● no clear distinction between agent (client) and policy hub (server) ● every agent can be policy hub for another set of agents ● agents updates policy files from hub ○ if policy hub is unreachable => policy files are not updated ○ every 5 minutes ○ no other mechanism to tell agents what to do
  • 26. Show me the code! bundle agent sshd_norootlogin { files: "/etc/ssh/sshd_config" edit_line => replace_or_add(".*PermitRootLogin.*", "PermitRootLogin no"); }
  • 27. Code ● covers many situations: ○ commented option ○ non-exist option ○ option set to other value than "no" ● how to handle various environments ? ○ using context ○ they're known also as the classes but their meaning is not the same as in OOP
  • 28. Context ● as a conditionals to handle different environments or state ○ does a file exist ? is pkg installed ? yes/no ○ is this system debian,ubuntu or windows? ○ is this system with hostname matching web* ? ● hard classes ○ discovered by cfengine ○ hostname, ip addresses, interfaces... ● soft classes ○ classes defined during runtime
  • 29. code++ bundle agent sshd_norootlogin { vars: debian:: "sshdconf" string => "/etc/ssh/sshd_config"; !debian:: "sshdconf" string => "/usr/local/etc/ssh/sshd_config"; files: "$(sshdconf)" edit_line => replace_or_add(".*PermitRootLogin.*", "PermitRootLogin no"); }
  • 30. Who am I and why CFEngine ● sysadmin @ Websupport.sk ● the biggest webhosting provider in Slovakia ● tens thousands of services (domains,vps, hostings) ● we're going to move all of them to new hardware infrastructure in few months ● we choosed CFEngine3 because of it features:
  • 31. The features that works for us ● strong theoretical background ○ where will be Puppet and Chef when hype ends ? ● small CPU and memory overhead ● scalability ○ we may need to handle 1000-2000 virtual servers ● model based monitoring http://bit.ly/Vle8zc ○ CFEngine can be used as a monitoring tool or as a addon to other monitoring tool ○ monitoring is self-learning => no need to setup anything ○ learns state of system for past 7 days ○ if metric value is larger than standard deviation => something unusual is happening
  • 32. Features that works for us ● knowledge maps ○ you may generate logical maps of subsystems from code ● is not written in ruby :) ○ we have strong experience with C