SlideShare une entreprise Scribd logo
1  sur  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 ?

Contenu connexe

Tendances

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)
 

Tendances (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
 

Similaire à Tomáš Čorej: Configuration management & CFEngine3

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 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". 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
 

Similaire à Tomáš Čorej: Configuration management & CFEngine3 (20)

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 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". 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....
 
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
 
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?
 
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
 

Plus de 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
 

Plus de 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
 

Dernier

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Dernier (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

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