SlideShare a Scribd company logo
Scaling antispam mail servers with Puppet
Giovanni Bechis
<g.bechis@snb.it>
@g_bechis
PuppetCamp 2020, Netherlands
About Me
sysadmin and developer @SNB
OpenBSD hacker for ∼ 12 years
Apache SpamAssassin committer
Apache httpd committer
random patches in random open source software (amavisd-new,
courier-imap, cyrus-sasl, memcached, ...)
”mail” software managed by Puppet
Unbound
Clamav
Postfix
OpenBSD spamd
Redis
Apache SpamAssassin
MimeDefang
Filebeat
Zabbix
Dns settings
class { ’resolv_conf’:
nameservers => [’127.0.0.1’, ’172.16.99.1’],
}
class { "unbound":
interface => ["127.0.0.1", "::1"],
access => ["127.0.0.0/8","::1"],
}
unbound::stub { "rbl0.example.lan":
address => ["172.16.99.137@53"],
insecure => true,
}
unbound::stub { "rbl1.example.lan":
address => ["172.16.99.137@53"],
insecure => true,
}
Puppet Facts
Some facts are interesting to scale in a right way all involved softwares
”os.name” to have different configuration for different operating systems
”processors.count” and ”memory.system.total bytes” to correctly
configure Clamav and Apache SpamAssassin
Puppet Facts and Erb templates
# Clamav template
# Maximum number of threads running at the same time.
# Default: 10
#MaxThreads 20
<% if @processors[’count’] != 1 -%>
MaxThreads 20
<% end -%>
# Path to a local socket file the daemon will listen on.
# Default: disabled (must be specified by a user)
#LocalSocket /tmp/clamd.socket
<% if @os[’name’] == ’OpenBSD’ -%>
LocalSocket /tmp/clamd
<% end -%>
Puppet Facts and Erb templates
# Mail::SpamAssassin::Plugin::ResourceLimits
<% if @memory[’system’][’total_bytes’] < 4142006272 -%>
resource_limit_mem 536870912
<% end -%>
Puppet Facts and Erb templates
redis::params { ’redis’:
bind => [’127.0.0.1’, ’172.16.99.134’],
masterauth => ’XXX’,
slaveof => ’172.16.99.133 6379’,
}
bind <%= @bind.join(’ ’) %>
<% if @masterauth -%>masterauth <%= @masterauth %><% end -%>
<% if @slaveof -%>slaveof <%= @slaveof %><% end -%>
Config files deploy
Config files deploy
Puppet server does a checkout of our
git repo and pulls updated
configuration files.
Most of the configuration files are the
same for all servers, lot of modules we
are using just copy the correct files in
the correct location.
OpenBSD spamd(8) configuration
exec {
’pf_test’ :
command => ’/sbin/pfctl -nf /etc/pf.conf’,
refreshonly => true,
notify => Exec[pf_load] ;
’pf_load’ :
command => ’/sbin/pfctl -f /etc/pf.conf’,
refreshonly => true ;
}
file { ’/etc/pf-spamd-white-local’:
ensure => file,
path => ’/etc/pf-spamd-white-local’,
owner => ’root’,
mode => ’0640’,
source => ’puppet:///modules/spamd/pf-spamd-white-local’,
notify => Exec[pf_test];
}
SpamAssassin rules configuration
file { ’/etc/mail/spamassassin/20_sought.cf’:
ensure => file,
path => ’/etc/mail/spamassassin/20_sought.cf’,
owner => ’root’,
mode => ’0640’,
source => ’puppet:///modules/spamassassin/20_sought.cf’,
notify => [
Service[’spamassassin’],
],
}
file { ’/etc/mail/spamassassin/sendinblue_id.txt’:
ensure => file,
path => ’/etc/mail/spamassassin/sendinblue_id.txt’,
owner => ’root’,
mode => ’0640’,
source => ’puppet:///modules/spamassassin/sendinblue_id.txt’,
notify => [
Service[’spamassassin’],
],
}
Mimedefang configuration and deploy
Mimedefang deploy
Mimedefang has both code and
configuration files that need to be
deployed.
Mimedefang has several dependencies
like SpamAssassin and Clamav, the
same dependency tree is respected on
Puppet code.
Mimedefang configuration
define mimedefang::params (
$user_scores_dsn = ’’,
$user_scores_sql_username = ’’,
$user_scores_sql_password = ’’,
){
include ::spamassassin
package { ’mimedefang’:
ensure => ’present’
}
file { ’/etc/mail/spamassassin/mimedefang.cf’:
ensure => file,
content => template(’mimedefang/mimedefang.cf.erb’),
path => ’/etc/mail/spamassassin/mimedefang.cf’,
owner => ’root’,
mode => ’0640’,
notify => [
Service[’spamassassin’],
],
}
}
Mimedefang configuration
mimedefang::params { ’mimedefang’:
user_scores_dsn => ’DBI:mysql:database:localhost’,
user_scores_sql_username => ’user’,
user_scores_sql_password => ’password’,
md_ft_VirusClamd => 0,
md_ft_Spamc => 1,
md_ft_SpamAssassin => 0,
md_ft_archive_zip => 1,
md_ft_unrar => 1,
}
$Features{"Spamc_max_size"} = <%= @md_ft_Spamc_max_size %>;
$Features{"SpamAssassin"} = <%= @md_ft_SpamAssassin %>;
$Features{"unrar"} = <%= @md_ft_unrar %>;
$cemail = "<%= scope().call_function(’hiera’,’md_cemail’); -%>";
}
Filebeat and Elk configuration
class { ’filebeat’:
outputs => {
’logstash’ => {
’hosts’ => [
’172.16.99.211:5001’,
],
},
},
fields_under_root => true,
}
filebeat::input { ’postfix’:
paths => [
’/var/log/maillog’,
’/var/log/spamd’,
],
doc_type => ’postfix’,
fields => { "logtype" => "postfix" },
}
Zabbix configuration
define zabbix::params (
$zabbix_server = ’zabbix.example.com’,
$zabbix_port = ’10050’
){
case $facts[’os’][’name’] {
’OpenBSD’: {
if ($facts[’os’][’release’][’major’] == ’6’) {
file { ’/etc/zabbix/zabbix_agent.conf’:
ensure => present,
content => template(’zabbix/zabbix_agent-openbsd.conf.erb’),
owner => ’root’,
group => ’wheel’,
notify => Service[’zabbix_agentd’],
}
}
}
}
}
Questions ?

More Related Content

What's hot

Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.
Takashi Yoshioka
 
Kumpulan script jahil
Kumpulan script jahilKumpulan script jahil
Kumpulan script jahil
UNP PGRI KEDIRI
 
Luc Suryo - Puppet on EC2
Luc Suryo - Puppet on EC2Luc Suryo - Puppet on EC2
Luc Suryo - Puppet on EC2
Puppet
 
Ravada VDI Eslibre
Ravada VDI EslibreRavada VDI Eslibre
Ravada VDI Eslibre
frankiejol
 
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
PROIDEA
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
Gagah Arifianto
 
Steam Learn: Composer
Steam Learn: ComposerSteam Learn: Composer
Steam Learn: Composer
inovia
 
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Develcz
 
PSR-7 and PSR-15, why can't you ignore them
PSR-7 and PSR-15, why can't you ignore themPSR-7 and PSR-15, why can't you ignore them
PSR-7 and PSR-15, why can't you ignore them
Sérgio Rafael Siqueira
 
Buffer overflow for Beginners
Buffer overflow for BeginnersBuffer overflow for Beginners
Buffer overflow for Beginners
Ajin Abraham
 
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012
Walter Heck
 
How to ride a whale
How to ride a whaleHow to ride a whale
How to ride a whale
Vincent Vermersh
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linux
gt0ne
 
An (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nixAn (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nix
Eleanor McHugh
 
Pursue container architecture with mincs
Pursue container architecture with mincsPursue container architecture with mincs
Pursue container architecture with mincs
Yuki Nishiwaki
 
Using the Command Line with Magento
Using the Command Line with MagentoUsing the Command Line with Magento
Using the Command Line with Magento
Matthew Haworth
 
Configuration Management with Cfengine
Configuration Management with CfengineConfiguration Management with Cfengine
Configuration Management with Cfengine
Steven Kreuzer
 
nginxをソースからインストールしてみたよ
nginxをソースからインストールしてみたよnginxをソースからインストールしてみたよ
nginxをソースからインストールしてみたよ
mamoru tateoka
 
Cis 216 – shell scripting
Cis 216 – shell scriptingCis 216 – shell scripting
Cis 216 – shell scripting
Dan Morrill
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
Gleicon Moraes
 

What's hot (20)

Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.
 
Kumpulan script jahil
Kumpulan script jahilKumpulan script jahil
Kumpulan script jahil
 
Luc Suryo - Puppet on EC2
Luc Suryo - Puppet on EC2Luc Suryo - Puppet on EC2
Luc Suryo - Puppet on EC2
 
Ravada VDI Eslibre
Ravada VDI EslibreRavada VDI Eslibre
Ravada VDI Eslibre
 
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
 
Steam Learn: Composer
Steam Learn: ComposerSteam Learn: Composer
Steam Learn: Composer
 
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
Ondřej Šika: Docker, Traefik a CI - Mějte nasazené všeny větve na kterých pra...
 
PSR-7 and PSR-15, why can't you ignore them
PSR-7 and PSR-15, why can't you ignore themPSR-7 and PSR-15, why can't you ignore them
PSR-7 and PSR-15, why can't you ignore them
 
Buffer overflow for Beginners
Buffer overflow for BeginnersBuffer overflow for Beginners
Buffer overflow for Beginners
 
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012
 
How to ride a whale
How to ride a whaleHow to ride a whale
How to ride a whale
 
Basic command for linux
Basic command for linuxBasic command for linux
Basic command for linux
 
An (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nixAn (abridged) Ruby Plumber's Guide to *nix
An (abridged) Ruby Plumber's Guide to *nix
 
Pursue container architecture with mincs
Pursue container architecture with mincsPursue container architecture with mincs
Pursue container architecture with mincs
 
Using the Command Line with Magento
Using the Command Line with MagentoUsing the Command Line with Magento
Using the Command Line with Magento
 
Configuration Management with Cfengine
Configuration Management with CfengineConfiguration Management with Cfengine
Configuration Management with Cfengine
 
nginxをソースからインストールしてみたよ
nginxをソースからインストールしてみたよnginxをソースからインストールしてみたよ
nginxをソースからインストールしてみたよ
 
Cis 216 – shell scripting
Cis 216 – shell scriptingCis 216 – shell scripting
Cis 216 – shell scripting
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 

Similar to Scaling antispam solutions with Puppet

Puppet
PuppetPuppet
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
Alessandro Franceschi
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
Carlos Sanchez
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
grim_radical
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Carlos Sanchez
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
garrett honeycutt
 
Fail2ban
Fail2banFail2ban
Fail2ban
Ruslan Conk
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
Carlos Sanchez
 
Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11
Yury Pliashkou
 
Server hardening
Server hardeningServer hardening
Server hardening
Teja Babu
 
Puppi. Puppet strings to the shell
Puppi. Puppet strings to the shellPuppi. Puppet strings to the shell
Puppi. Puppet strings to the shell
Alessandro Franceschi
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
Agile Spain
 
EC2
EC2EC2
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet ModulesStanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
Puppet
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
OlinData
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to do
Puppet
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
Walter Heck
 
Nmap Scripting Engine and http-enumeration
Nmap Scripting Engine and http-enumerationNmap Scripting Engine and http-enumeration
Nmap Scripting Engine and http-enumeration
Robert Rowley
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
Puppet
 

Similar to Scaling antispam solutions with Puppet (20)

Puppet
PuppetPuppet
Puppet
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
Fail2ban
Fail2banFail2ban
Fail2ban
 
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - ApacheCON NA 2011
 
Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11Capifony. Minsk PHP MeetUp #11
Capifony. Minsk PHP MeetUp #11
 
Server hardening
Server hardeningServer hardening
Server hardening
 
Puppi. Puppet strings to the shell
Puppi. Puppet strings to the shellPuppi. Puppet strings to the shell
Puppi. Puppet strings to the shell
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
 
EC2
EC2EC2
EC2
 
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet ModulesStanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to do
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
 
Nmap Scripting Engine and http-enumeration
Nmap Scripting Engine and http-enumerationNmap Scripting Engine and http-enumeration
Nmap Scripting Engine and http-enumeration
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
 

More from Giovanni Bechis

the Apache way
the Apache waythe Apache way
the Apache way
Giovanni Bechis
 
SpamAssassin 4.0 new features
SpamAssassin 4.0 new featuresSpamAssassin 4.0 new features
SpamAssassin 4.0 new features
Giovanni Bechis
 
ACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easyACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easy
Giovanni Bechis
 
What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3
Giovanni Bechis
 
Fighting Spam for fun and profit
Fighting Spam for fun and profitFighting Spam for fun and profit
Fighting Spam for fun and profit
Giovanni Bechis
 
Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)
Giovanni Bechis
 
Pledge in OpenBSD
Pledge in OpenBSDPledge in OpenBSD
Pledge in OpenBSD
Giovanni Bechis
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filter
Giovanni Bechis
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
Giovanni Bechis
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safe
Giovanni Bechis
 
OpenSMTPD: we deliver !!
OpenSMTPD: we deliver !!OpenSMTPD: we deliver !!
OpenSMTPD: we deliver !!
Giovanni Bechis
 
LibreSSL, one year later
LibreSSL, one year laterLibreSSL, one year later
LibreSSL, one year later
Giovanni Bechis
 
LibreSSL
LibreSSLLibreSSL
LibreSSL
Giovanni Bechis
 
SOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open SourceSOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open Source
Giovanni Bechis
 
Cloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con teCloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con te
Giovanni Bechis
 
Npppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSDNpppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSD
Giovanni Bechis
 
Openssh: comunicare in sicurezza
Openssh: comunicare in sicurezzaOpenssh: comunicare in sicurezza
Openssh: comunicare in sicurezza
Giovanni Bechis
 
Ipv6: il futuro di internet
Ipv6: il futuro di internetIpv6: il futuro di internet
Ipv6: il futuro di internet
Giovanni Bechis
 
L'ABC della crittografia
L'ABC della crittografiaL'ABC della crittografia
L'ABC della crittografia
Giovanni Bechis
 
Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD
Giovanni Bechis
 

More from Giovanni Bechis (20)

the Apache way
the Apache waythe Apache way
the Apache way
 
SpamAssassin 4.0 new features
SpamAssassin 4.0 new featuresSpamAssassin 4.0 new features
SpamAssassin 4.0 new features
 
ACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easyACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easy
 
What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3
 
Fighting Spam for fun and profit
Fighting Spam for fun and profitFighting Spam for fun and profit
Fighting Spam for fun and profit
 
Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)
 
Pledge in OpenBSD
Pledge in OpenBSDPledge in OpenBSD
Pledge in OpenBSD
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filter
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safe
 
OpenSMTPD: we deliver !!
OpenSMTPD: we deliver !!OpenSMTPD: we deliver !!
OpenSMTPD: we deliver !!
 
LibreSSL, one year later
LibreSSL, one year laterLibreSSL, one year later
LibreSSL, one year later
 
LibreSSL
LibreSSLLibreSSL
LibreSSL
 
SOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open SourceSOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open Source
 
Cloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con teCloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con te
 
Npppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSDNpppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSD
 
Openssh: comunicare in sicurezza
Openssh: comunicare in sicurezzaOpenssh: comunicare in sicurezza
Openssh: comunicare in sicurezza
 
Ipv6: il futuro di internet
Ipv6: il futuro di internetIpv6: il futuro di internet
Ipv6: il futuro di internet
 
L'ABC della crittografia
L'ABC della crittografiaL'ABC della crittografia
L'ABC della crittografia
 
Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD
 

Recently uploaded

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 

Recently uploaded (20)

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 

Scaling antispam solutions with Puppet

  • 1. Scaling antispam mail servers with Puppet Giovanni Bechis <g.bechis@snb.it> @g_bechis PuppetCamp 2020, Netherlands
  • 2. About Me sysadmin and developer @SNB OpenBSD hacker for ∼ 12 years Apache SpamAssassin committer Apache httpd committer random patches in random open source software (amavisd-new, courier-imap, cyrus-sasl, memcached, ...)
  • 3. ”mail” software managed by Puppet Unbound Clamav Postfix OpenBSD spamd Redis Apache SpamAssassin MimeDefang Filebeat Zabbix
  • 4. Dns settings class { ’resolv_conf’: nameservers => [’127.0.0.1’, ’172.16.99.1’], } class { "unbound": interface => ["127.0.0.1", "::1"], access => ["127.0.0.0/8","::1"], } unbound::stub { "rbl0.example.lan": address => ["172.16.99.137@53"], insecure => true, } unbound::stub { "rbl1.example.lan": address => ["172.16.99.137@53"], insecure => true, }
  • 5. Puppet Facts Some facts are interesting to scale in a right way all involved softwares ”os.name” to have different configuration for different operating systems ”processors.count” and ”memory.system.total bytes” to correctly configure Clamav and Apache SpamAssassin
  • 6. Puppet Facts and Erb templates # Clamav template # Maximum number of threads running at the same time. # Default: 10 #MaxThreads 20 <% if @processors[’count’] != 1 -%> MaxThreads 20 <% end -%> # Path to a local socket file the daemon will listen on. # Default: disabled (must be specified by a user) #LocalSocket /tmp/clamd.socket <% if @os[’name’] == ’OpenBSD’ -%> LocalSocket /tmp/clamd <% end -%>
  • 7. Puppet Facts and Erb templates # Mail::SpamAssassin::Plugin::ResourceLimits <% if @memory[’system’][’total_bytes’] < 4142006272 -%> resource_limit_mem 536870912 <% end -%>
  • 8. Puppet Facts and Erb templates redis::params { ’redis’: bind => [’127.0.0.1’, ’172.16.99.134’], masterauth => ’XXX’, slaveof => ’172.16.99.133 6379’, } bind <%= @bind.join(’ ’) %> <% if @masterauth -%>masterauth <%= @masterauth %><% end -%> <% if @slaveof -%>slaveof <%= @slaveof %><% end -%>
  • 9. Config files deploy Config files deploy Puppet server does a checkout of our git repo and pulls updated configuration files. Most of the configuration files are the same for all servers, lot of modules we are using just copy the correct files in the correct location.
  • 10. OpenBSD spamd(8) configuration exec { ’pf_test’ : command => ’/sbin/pfctl -nf /etc/pf.conf’, refreshonly => true, notify => Exec[pf_load] ; ’pf_load’ : command => ’/sbin/pfctl -f /etc/pf.conf’, refreshonly => true ; } file { ’/etc/pf-spamd-white-local’: ensure => file, path => ’/etc/pf-spamd-white-local’, owner => ’root’, mode => ’0640’, source => ’puppet:///modules/spamd/pf-spamd-white-local’, notify => Exec[pf_test]; }
  • 11. SpamAssassin rules configuration file { ’/etc/mail/spamassassin/20_sought.cf’: ensure => file, path => ’/etc/mail/spamassassin/20_sought.cf’, owner => ’root’, mode => ’0640’, source => ’puppet:///modules/spamassassin/20_sought.cf’, notify => [ Service[’spamassassin’], ], } file { ’/etc/mail/spamassassin/sendinblue_id.txt’: ensure => file, path => ’/etc/mail/spamassassin/sendinblue_id.txt’, owner => ’root’, mode => ’0640’, source => ’puppet:///modules/spamassassin/sendinblue_id.txt’, notify => [ Service[’spamassassin’], ], }
  • 12. Mimedefang configuration and deploy Mimedefang deploy Mimedefang has both code and configuration files that need to be deployed. Mimedefang has several dependencies like SpamAssassin and Clamav, the same dependency tree is respected on Puppet code.
  • 13. Mimedefang configuration define mimedefang::params ( $user_scores_dsn = ’’, $user_scores_sql_username = ’’, $user_scores_sql_password = ’’, ){ include ::spamassassin package { ’mimedefang’: ensure => ’present’ } file { ’/etc/mail/spamassassin/mimedefang.cf’: ensure => file, content => template(’mimedefang/mimedefang.cf.erb’), path => ’/etc/mail/spamassassin/mimedefang.cf’, owner => ’root’, mode => ’0640’, notify => [ Service[’spamassassin’], ], } }
  • 14. Mimedefang configuration mimedefang::params { ’mimedefang’: user_scores_dsn => ’DBI:mysql:database:localhost’, user_scores_sql_username => ’user’, user_scores_sql_password => ’password’, md_ft_VirusClamd => 0, md_ft_Spamc => 1, md_ft_SpamAssassin => 0, md_ft_archive_zip => 1, md_ft_unrar => 1, } $Features{"Spamc_max_size"} = <%= @md_ft_Spamc_max_size %>; $Features{"SpamAssassin"} = <%= @md_ft_SpamAssassin %>; $Features{"unrar"} = <%= @md_ft_unrar %>; $cemail = "<%= scope().call_function(’hiera’,’md_cemail’); -%>"; }
  • 15. Filebeat and Elk configuration class { ’filebeat’: outputs => { ’logstash’ => { ’hosts’ => [ ’172.16.99.211:5001’, ], }, }, fields_under_root => true, } filebeat::input { ’postfix’: paths => [ ’/var/log/maillog’, ’/var/log/spamd’, ], doc_type => ’postfix’, fields => { "logtype" => "postfix" }, }
  • 16. Zabbix configuration define zabbix::params ( $zabbix_server = ’zabbix.example.com’, $zabbix_port = ’10050’ ){ case $facts[’os’][’name’] { ’OpenBSD’: { if ($facts[’os’][’release’][’major’] == ’6’) { file { ’/etc/zabbix/zabbix_agent.conf’: ensure => present, content => template(’zabbix/zabbix_agent-openbsd.conf.erb’), owner => ’root’, group => ’wheel’, notify => Service[’zabbix_agentd’], } } } } }