SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Fighting Spam with a Perimeter Mail System



           Garrett Honeycutt
           Eric Heydrick


           08-Nov-2007 @ SASAG
Intro

Hello and stuff
 Speakeasy started as the first internet cafe in 1995 and soon
 became a broadband provider. We currently provide DSL and T1
 connectivity nation wide as well as managed services.
 One of our more exciting endeavours is VoIP
 You should probably be working for us
The world before the perimeter
The world before the perimeter
The world before the perimeter
Why move to a tiered system?

Lots of pieces to the puzzle – easy to swap the services
between hardware
 greylisting
 virus scanning
 spam tagging
 mail delivery / relaying
Why move to a tiered system?

Scale out the different pieces that comprise mail as
necessary.


Protect mail delivery, which you might not be able to control
or change easily.
 qmail cluster
 exchange
The world before the perimeter
The world with a MX perim
LB Configs
The world with a MX perim

Hardware
 8x perim - 3GHz boxes with HT and 2GB of RAM
 2x DB - 2x Dual core 2.8GHz boxes with 16GB of RAM
   Initially less RAM, but upgraded to handle bad greylisting software
   your mileage may vary here, just be sure to keep the DB happy
Network
 Private gigE network between perim and DB
 Another load balancer between the internet and the perim
Postfix

Ensure RFC compliance for role accounts – keep abuse
department busy
 Put this line towards the top of smtpd_recipient_restrictions in
 your main.cf
   check_recipient_access hash:/etc/postfix/roleaccount_exceptions
 roleaccount_exceptions:
   postmaster@ OK
   abuse@ OK
   hostmaster@ OK
   webmaster@ OK
Postfix

LDAP recipient check
 Could be file / mysql / etc
 This check is done pre-queue, which gives the sender an immediate
 failure instead of a message after the fact
 Be sure that your user backend system can keep up, since you are
 not queuing
 use proxy map – provides read-only table lookup service to all
 Postfix processes
   check_recipient_access proxy:ldap:/etc/postfix/ldap-recip-check.cf
Postfix / LDAP integration
Postfix

Bump up default limits
# The maximal number of parallel deliveries to the same
destination via the relay message delivery transport. Default
is 20.
relay_destination_concurrency_limit = 100
# let more than the default number of daemons run, so we
can handle more simultaneous inbound connections
default_process_limit = 512
GLD

Greylisting service written in C
 Why GLD?
   Inherited it with project – Checking out sqlgrey
 Only two SQL tables, horribly inefficient
 Allows for greylisting a /24 instead of each IP – needed for clusters
 After x successful mails the sender/IP combo is trusted and not
 greylisted – helps for legitimate bulk mail
 Be sure to check out whitelist on greylist.org and whitelist time
 sensitive sites, like eBay.
 check_policy_service inet:127.0.0.1:2525 in your main.cf
GLD
GLD

Performance Tuning
 Upped max connections – this has a direct relation to DB access
 Changed DB to use InnoDB for row level locking
 Changed table to use varchar instead of char
 Tuned the DB's extensively to handle large InnoDB tables
 Used a private gigE network for DB traffic
GLD

Results
 60% of mail greylisted did not come back
 Less mail for the more hardware intensive antivirus checking and
 spam tagging
 Less mail for the mail delivery system to store
amavisd-new / ClamAV
RFC Checking / Antivirus
    amavisd-new does some RFC checking, such as <> around
    addresses
    amavisd-new calls clamav pre-queue
      This allows for quick response and avoids backscatter at the expense of
      having fast antivirus machines that can keep up with the mail load
    postfix's master.cf
      # use a proxy_filter instead of a content filter so that the mail does not
      have to be queued
         smtp    inet n     -    -   -    -    smtpd
         -o smtpd_proxy_filter=localhost:10024
         -o smtp_data_done_timeout=1200
amavisd-new / ClamAV

Performance Tuning
 Bump up simultaneous servers
$max_servers = 16; # default is 2
 Each amavisd process is using about 20MB of memory
 One clamav process that uses about 300MB of memory
 Shared memory mount for /var/lib/amavis
   cuts way down on disk IO.
   Ours is 400MB, make sure that yours is large enough or amavis with barf
   on you and cause a cascade effect
amavisd-new / ClamAV

  First line is important to scan entire message and catch phishing
@keep_decoded_original_maps = (new_RE(
qr'^MAIL$', # retain full original message for virus checking (can be slow)
qr'^MAIL-UNDECIPHERABLE$', # recheck full mail if it contains undecipherables
qr'^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)'i,
));
DNS queries

Mail lookups generate a lot of DNS traffic
 We have caching DNS servers on the DB servers
   each perim box points to these machines over the private network
   you could run a caching dns server on each perim box if memory allows
Graphs are good

Keep stats
 We use cacti to graph stats from the mail servers
 Messages received, SMTP connections, viruses found, queue size,
 and more
 Graphs are not only informative, they also aid in troubleshooting
Graphs are good

Cacti graphs




               Messages received over a week period
Graphs are good

Cacti graphs




               Messages greylisted over a week period
Graphs are good

Cacti graphs




               Queue size over a week period
Load Testing

Load test before putting service into production
 Step 1: determine the load of the current system
 Step 2: attempt to simulate current load on new system
 Step 3: analyze test results to validate that new system can handle
 the load
Load Testing

Postfix includes handy mail load testing tools
 We used smtp-source and smtp-sink included with Postfix
 smtp-source generates mail, smtp-sink listens on port 25 and shoves
 messages to /dev/null
 We used 2 load generation boxes and 3 sink boxes. Scale this as
 appropriate
Load Testing

Using smtp-source/sink
 Start the sink:

      # smtp-sink -c mailsink1:25 10000



 Start the source:

      # smtp-source -c -m -l 512 -m 1000 -s 10 localhost:25




    start 10 threads each sending 1000 512 byte messages to localhost:25
Load Testing
It's important to load test all system parts
 Load test all moving parts
 Mail servers, database servers, load balancers, LDAP, DNS queries
 You don't want any surprises in production!

Contenu connexe

Tendances

Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0StreamNative
 
Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)Hari
 
How Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar communityHow Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar communityStreamNative
 
Testing Kafka components with Kafka for JUnit
Testing Kafka components with Kafka for JUnitTesting Kafka components with Kafka for JUnit
Testing Kafka components with Kafka for JUnitMarkus Günther
 
NoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePackNoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePackSadayuki Furuhashi
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queueSoftwareMill
 
Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0StreamNative
 
A Quick Guide to Refresh Kafka Skills
A Quick Guide to Refresh Kafka SkillsA Quick Guide to Refresh Kafka Skills
A Quick Guide to Refresh Kafka SkillsRavindra kumar
 
Google File Systems
Google File SystemsGoogle File Systems
Google File SystemsAzeem Mumtaz
 
How Time To First Byte (TTFB) Impacts Your Site’s Performance
How Time To First Byte (TTFB) Impacts Your Site’s PerformanceHow Time To First Byte (TTFB) Impacts Your Site’s Performance
How Time To First Byte (TTFB) Impacts Your Site’s PerformanceMedianova
 
Understanding kafka
Understanding kafkaUnderstanding kafka
Understanding kafkaAmitDhodi
 
10135 a 07
10135 a 0710135 a 07
10135 a 07Bố Su
 
Service Redundancy and Traffic Balancing Using Anycast
Service Redundancy and Traffic Balancing Using AnycastService Redundancy and Traffic Balancing Using Anycast
Service Redundancy and Traffic Balancing Using AnycastSean Jain Ellis
 
Scaling PostgreSQL with Skytools
Scaling PostgreSQL with SkytoolsScaling PostgreSQL with Skytools
Scaling PostgreSQL with SkytoolsGavin Roy
 
Network and TCP performance relationship workshop
Network and TCP performance relationship workshopNetwork and TCP performance relationship workshop
Network and TCP performance relationship workshopKae Hsu
 
bdNOG 7 - Re-engineering the DNS - one resolver at a time
bdNOG 7 - Re-engineering the DNS - one resolver at a timebdNOG 7 - Re-engineering the DNS - one resolver at a time
bdNOG 7 - Re-engineering the DNS - one resolver at a timeAPNIC
 
A Comprehensive Guide for DNS Cluster Configurations
A Comprehensive Guide for DNS Cluster ConfigurationsA Comprehensive Guide for DNS Cluster Configurations
A Comprehensive Guide for DNS Cluster ConfigurationsHTS Hosting
 

Tendances (20)

Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0
 
Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)Building Linux IPv6 DNS Server (Complete Soft Copy)
Building Linux IPv6 DNS Server (Complete Soft Copy)
 
How Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar communityHow Zhaopin contributes to Pulsar community
How Zhaopin contributes to Pulsar community
 
Testing Kafka components with Kafka for JUnit
Testing Kafka components with Kafka for JUnitTesting Kafka components with Kafka for JUnit
Testing Kafka components with Kafka for JUnit
 
NoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePackNoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePack
 
Kafka as a message queue
Kafka as a message queueKafka as a message queue
Kafka as a message queue
 
Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0Preview of Apache Pulsar 2.5.0
Preview of Apache Pulsar 2.5.0
 
A Quick Guide to Refresh Kafka Skills
A Quick Guide to Refresh Kafka SkillsA Quick Guide to Refresh Kafka Skills
A Quick Guide to Refresh Kafka Skills
 
Google File Systems
Google File SystemsGoogle File Systems
Google File Systems
 
How Time To First Byte (TTFB) Impacts Your Site’s Performance
How Time To First Byte (TTFB) Impacts Your Site’s PerformanceHow Time To First Byte (TTFB) Impacts Your Site’s Performance
How Time To First Byte (TTFB) Impacts Your Site’s Performance
 
Understanding kafka
Understanding kafkaUnderstanding kafka
Understanding kafka
 
Ubuntu For Intranet Services
Ubuntu For Intranet ServicesUbuntu For Intranet Services
Ubuntu For Intranet Services
 
Apache Kafka Demo
Apache Kafka DemoApache Kafka Demo
Apache Kafka Demo
 
10135 a 07
10135 a 0710135 a 07
10135 a 07
 
Service Redundancy and Traffic Balancing Using Anycast
Service Redundancy and Traffic Balancing Using AnycastService Redundancy and Traffic Balancing Using Anycast
Service Redundancy and Traffic Balancing Using Anycast
 
Scaling PostgreSQL with Skytools
Scaling PostgreSQL with SkytoolsScaling PostgreSQL with Skytools
Scaling PostgreSQL with Skytools
 
Network and TCP performance relationship workshop
Network and TCP performance relationship workshopNetwork and TCP performance relationship workshop
Network and TCP performance relationship workshop
 
bdNOG 7 - Re-engineering the DNS - one resolver at a time
bdNOG 7 - Re-engineering the DNS - one resolver at a timebdNOG 7 - Re-engineering the DNS - one resolver at a time
bdNOG 7 - Re-engineering the DNS - one resolver at a time
 
DNS-SD Extentions
DNS-SD ExtentionsDNS-SD Extentions
DNS-SD Extentions
 
A Comprehensive Guide for DNS Cluster Configurations
A Comprehensive Guide for DNS Cluster ConfigurationsA Comprehensive Guide for DNS Cluster Configurations
A Comprehensive Guide for DNS Cluster Configurations
 

En vedette

Deployment Of Multi-Network Video And Voice Conferencing On A ...
Deployment Of Multi-Network Video And Voice Conferencing On A ...Deployment Of Multi-Network Video And Voice Conferencing On A ...
Deployment Of Multi-Network Video And Voice Conferencing On A ...Videoguy
 
A Customized Approach to HTTP Proxy Caching in Ruby
A Customized Approach to HTTP Proxy Caching in RubyA Customized Approach to HTTP Proxy Caching in Ruby
A Customized Approach to HTTP Proxy Caching in RubyPerry Carbone
 
Fighting Internet and Wireless Spam Act
Fighting Internet and Wireless Spam ActFighting Internet and Wireless Spam Act
Fighting Internet and Wireless Spam ActMatt Vernhout
 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcaRenu Thakur
 
Fighting spam using social gate keepers
Fighting spam using social gate keepersFighting spam using social gate keepers
Fighting spam using social gate keepersHein Min Htike
 
URL Presentation
URL PresentationURL Presentation
URL PresentationvRudd
 
Web Search and SEO - Web Technologies (1019888BNR)
Web Search and SEO - Web Technologies (1019888BNR)Web Search and SEO - Web Technologies (1019888BNR)
Web Search and SEO - Web Technologies (1019888BNR)Beat Signer
 
Security, Privacy and Trust - Web Technologies (1019888BNR)
Security, Privacy and Trust - Web Technologies (1019888BNR)Security, Privacy and Trust - Web Technologies (1019888BNR)
Security, Privacy and Trust - Web Technologies (1019888BNR)Beat Signer
 
Methods of connecting internet
Methods of connecting internetMethods of connecting internet
Methods of connecting internetTittu Anna
 
Url Presentation
Url PresentationUrl Presentation
Url Presentationsanniii
 
Skiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completeSkiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completezukun
 
Types of internet connections
Types of internet connectionsTypes of internet connections
Types of internet connectionsadrianne1114
 
Security and Privacy on the Web in 2016
Security and Privacy on the Web in 2016Security and Privacy on the Web in 2016
Security and Privacy on the Web in 2016Francois Marier
 
Designing Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field ExperimentsDesigning Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field ExperimentsGene Moo Lee
 

En vedette (20)

Deployment Of Multi-Network Video And Voice Conferencing On A ...
Deployment Of Multi-Network Video And Voice Conferencing On A ...Deployment Of Multi-Network Video And Voice Conferencing On A ...
Deployment Of Multi-Network Video And Voice Conferencing On A ...
 
A Customized Approach to HTTP Proxy Caching in Ruby
A Customized Approach to HTTP Proxy Caching in RubyA Customized Approach to HTTP Proxy Caching in Ruby
A Customized Approach to HTTP Proxy Caching in Ruby
 
Fighting spam
Fighting spamFighting spam
Fighting spam
 
What is Usenet?
What is Usenet?What is Usenet?
What is Usenet?
 
Chapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data StreamChapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data Stream
 
Fighting Internet and Wireless Spam Act
Fighting Internet and Wireless Spam ActFighting Internet and Wireless Spam Act
Fighting Internet and Wireless Spam Act
 
internet programming and java notes 5th sem mca
internet programming and java notes 5th sem mcainternet programming and java notes 5th sem mca
internet programming and java notes 5th sem mca
 
Fighting spam using social gate keepers
Fighting spam using social gate keepersFighting spam using social gate keepers
Fighting spam using social gate keepers
 
URL Presentation
URL PresentationURL Presentation
URL Presentation
 
Web Search and SEO - Web Technologies (1019888BNR)
Web Search and SEO - Web Technologies (1019888BNR)Web Search and SEO - Web Technologies (1019888BNR)
Web Search and SEO - Web Technologies (1019888BNR)
 
Security, Privacy and Trust - Web Technologies (1019888BNR)
Security, Privacy and Trust - Web Technologies (1019888BNR)Security, Privacy and Trust - Web Technologies (1019888BNR)
Security, Privacy and Trust - Web Technologies (1019888BNR)
 
Methods of connecting internet
Methods of connecting internetMethods of connecting internet
Methods of connecting internet
 
Chapter 3 : User Datagram Protocol (UDP)
Chapter 3 : User Datagram Protocol (UDP)Chapter 3 : User Datagram Protocol (UDP)
Chapter 3 : User Datagram Protocol (UDP)
 
Url Presentation
Url PresentationUrl Presentation
Url Presentation
 
Skiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completeSkiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np complete
 
Types of internet connections
Types of internet connectionsTypes of internet connections
Types of internet connections
 
Email
EmailEmail
Email
 
Security and Privacy on the Web in 2016
Security and Privacy on the Web in 2016Security and Privacy on the Web in 2016
Security and Privacy on the Web in 2016
 
Designing Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field ExperimentsDesigning Cybersecurity Policies with Field Experiments
Designing Cybersecurity Policies with Field Experiments
 
Newsgroups
NewsgroupsNewsgroups
Newsgroups
 

Similaire à Fighting Spam With A Perimeter Mail System 20071108 Sasag

Self Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWSSelf Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWSsharu1204
 
Distribute Key Value Store
Distribute Key Value StoreDistribute Key Value Store
Distribute Key Value StoreSantal Li
 
Distribute key value_store
Distribute key value_storeDistribute key value_store
Distribute key value_storedrewz lin
 
NoSQL afternoon in Japan kumofs & MessagePack
NoSQL afternoon in Japan kumofs & MessagePackNoSQL afternoon in Japan kumofs & MessagePack
NoSQL afternoon in Japan kumofs & MessagePackSadayuki Furuhashi
 
Air traffic controller - Streams Processing meetup
Air traffic controller  - Streams Processing meetupAir traffic controller  - Streams Processing meetup
Air traffic controller - Streams Processing meetupEd Yakabosky
 
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQCluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQShameera Rathnayaka
 
Spinnaker VLDB 2011
Spinnaker VLDB 2011Spinnaker VLDB 2011
Spinnaker VLDB 2011sandeep_tata
 
Multitenancy: Kafka clusters for everyone at LINE
Multitenancy: Kafka clusters for everyone at LINEMultitenancy: Kafka clusters for everyone at LINE
Multitenancy: Kafka clusters for everyone at LINEkawamuray
 
Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE confluent
 
Kafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINEKafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINEkawamuray
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 
Full Stack Load Testing
Full Stack Load Testing Full Stack Load Testing
Full Stack Load Testing Terral R Jordan
 
2.communcation in distributed system
2.communcation in distributed system2.communcation in distributed system
2.communcation in distributed systemGd Goenka University
 
Developing Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaDeveloping Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaJoe Stein
 
IPVS for Docker Containers
IPVS for Docker ContainersIPVS for Docker Containers
IPVS for Docker ContainersBob Sokol
 
[En] IPVS for Docker Containers
[En] IPVS for Docker Containers[En] IPVS for Docker Containers
[En] IPVS for Docker ContainersAndrey Sibirev
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuningprathap kumar
 

Similaire à Fighting Spam With A Perimeter Mail System 20071108 Sasag (20)

Self Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWSSelf Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWS
 
Distribute Key Value Store
Distribute Key Value StoreDistribute Key Value Store
Distribute Key Value Store
 
Distribute key value_store
Distribute key value_storeDistribute key value_store
Distribute key value_store
 
NoSQL afternoon in Japan kumofs & MessagePack
NoSQL afternoon in Japan kumofs & MessagePackNoSQL afternoon in Japan kumofs & MessagePack
NoSQL afternoon in Japan kumofs & MessagePack
 
Air traffic controller - Streams Processing meetup
Air traffic controller  - Streams Processing meetupAir traffic controller  - Streams Processing meetup
Air traffic controller - Streams Processing meetup
 
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQCluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
 
Spinnaker VLDB 2011
Spinnaker VLDB 2011Spinnaker VLDB 2011
Spinnaker VLDB 2011
 
Multitenancy: Kafka clusters for everyone at LINE
Multitenancy: Kafka clusters for everyone at LINEMultitenancy: Kafka clusters for everyone at LINE
Multitenancy: Kafka clusters for everyone at LINE
 
Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy—160 Billion Daily Messages on One Shared Cluster at LINE
 
Kafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINEKafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINE
Kafka Multi-Tenancy - 160 Billion Daily Messages on One Shared Cluster at LINE
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
MPLS ppt
MPLS pptMPLS ppt
MPLS ppt
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
Full Stack Load Testing
Full Stack Load Testing Full Stack Load Testing
Full Stack Load Testing
 
2.communcation in distributed system
2.communcation in distributed system2.communcation in distributed system
2.communcation in distributed system
 
Developing Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaDeveloping Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache Kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
IPVS for Docker Containers
IPVS for Docker ContainersIPVS for Docker Containers
IPVS for Docker Containers
 
[En] IPVS for Docker Containers
[En] IPVS for Docker Containers[En] IPVS for Docker Containers
[En] IPVS for Docker Containers
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuning
 

Plus de garrett honeycutt

Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...
Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...
Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...garrett honeycutt
 
Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...
Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...
Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...garrett honeycutt
 
(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Images(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Imagesgarrett honeycutt
 
20150613 self-puppet v4-avoiding_dragons
20150613 self-puppet v4-avoiding_dragons20150613 self-puppet v4-avoiding_dragons
20150613 self-puppet v4-avoiding_dragonsgarrett honeycutt
 
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...garrett honeycutt
 
2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14
2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA142014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14
2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14garrett honeycutt
 
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattlegarrett honeycutt
 
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicagogarrett honeycutt
 
20140406 loa days-tdd-with_puppet_tutorial
20140406 loa days-tdd-with_puppet_tutorial20140406 loa days-tdd-with_puppet_tutorial
20140406 loa days-tdd-with_puppet_tutorialgarrett honeycutt
 
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07garrett honeycutt
 
20130407 load puppevtv3-and_hiera
20130407 load puppevtv3-and_hiera20130407 load puppevtv3-and_hiera
20130407 load puppevtv3-and_hieragarrett honeycutt
 
20120331 - Expanded Intro to Puppet for LOAD
20120331 - Expanded Intro to Puppet for LOAD20120331 - Expanded Intro to Puppet for LOAD
20120331 - Expanded Intro to Puppet for LOADgarrett honeycutt
 
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...garrett honeycutt
 
20110611 expanded intro-to_puppet_for_self
20110611 expanded intro-to_puppet_for_self20110611 expanded intro-to_puppet_for_self
20110611 expanded intro-to_puppet_for_selfgarrett honeycutt
 
20100425 Configuration Management With Puppet Lfnw
20100425 Configuration Management With Puppet Lfnw20100425 Configuration Management With Puppet Lfnw
20100425 Configuration Management With Puppet Lfnwgarrett honeycutt
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasaggarrett honeycutt
 

Plus de garrett honeycutt (17)

20180823 - Sensu + Puppet
20180823 - Sensu + Puppet20180823 - Sensu + Puppet
20180823 - Sensu + Puppet
 
Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...
Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...
Continuous Deployment Pipeline for Systems - Presented at Ohio LinuxFest 2017...
 
Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...
Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...
Continuous Deployment Pipeline for Systems at Cascadia IT Conference - 2017-0...
 
(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Images(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Images
 
20150613 self-puppet v4-avoiding_dragons
20150613 self-puppet v4-avoiding_dragons20150613 self-puppet v4-avoiding_dragons
20150613 self-puppet v4-avoiding_dragons
 
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...20150314  - Functional Testing for Configuration Management @ Cascadia IT Con...
20150314 - Functional Testing for Configuration Management @ Cascadia IT Con...
 
2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14
2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA142014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14
2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14
 
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
2014-11-11 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Seattle
 
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
 
20140406 loa days-tdd-with_puppet_tutorial
20140406 loa days-tdd-with_puppet_tutorial20140406 loa days-tdd-with_puppet_tutorial
20140406 loa days-tdd-with_puppet_tutorial
 
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
 
20130407 load puppevtv3-and_hiera
20130407 load puppevtv3-and_hiera20130407 load puppevtv3-and_hiera
20130407 load puppevtv3-and_hiera
 
20120331 - Expanded Intro to Puppet for LOAD
20120331 - Expanded Intro to Puppet for LOAD20120331 - Expanded Intro to Puppet for LOAD
20120331 - Expanded Intro to Puppet for LOAD
 
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
20111110 how puppet-fits_into_your_existing_infrastructure_and_change_managem...
 
20110611 expanded intro-to_puppet_for_self
20110611 expanded intro-to_puppet_for_self20110611 expanded intro-to_puppet_for_self
20110611 expanded intro-to_puppet_for_self
 
20100425 Configuration Management With Puppet Lfnw
20100425 Configuration Management With Puppet Lfnw20100425 Configuration Management With Puppet Lfnw
20100425 Configuration Management With Puppet Lfnw
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 

Fighting Spam With A Perimeter Mail System 20071108 Sasag

  • 1.
  • 2. Fighting Spam with a Perimeter Mail System Garrett Honeycutt Eric Heydrick 08-Nov-2007 @ SASAG
  • 3. Intro Hello and stuff Speakeasy started as the first internet cafe in 1995 and soon became a broadband provider. We currently provide DSL and T1 connectivity nation wide as well as managed services. One of our more exciting endeavours is VoIP You should probably be working for us
  • 4. The world before the perimeter
  • 5. The world before the perimeter
  • 6. The world before the perimeter
  • 7. Why move to a tiered system? Lots of pieces to the puzzle – easy to swap the services between hardware greylisting virus scanning spam tagging mail delivery / relaying
  • 8. Why move to a tiered system? Scale out the different pieces that comprise mail as necessary. Protect mail delivery, which you might not be able to control or change easily. qmail cluster exchange
  • 9. The world before the perimeter
  • 10. The world with a MX perim
  • 12. The world with a MX perim Hardware 8x perim - 3GHz boxes with HT and 2GB of RAM 2x DB - 2x Dual core 2.8GHz boxes with 16GB of RAM Initially less RAM, but upgraded to handle bad greylisting software your mileage may vary here, just be sure to keep the DB happy Network Private gigE network between perim and DB Another load balancer between the internet and the perim
  • 13. Postfix Ensure RFC compliance for role accounts – keep abuse department busy Put this line towards the top of smtpd_recipient_restrictions in your main.cf check_recipient_access hash:/etc/postfix/roleaccount_exceptions roleaccount_exceptions: postmaster@ OK abuse@ OK hostmaster@ OK webmaster@ OK
  • 14. Postfix LDAP recipient check Could be file / mysql / etc This check is done pre-queue, which gives the sender an immediate failure instead of a message after the fact Be sure that your user backend system can keep up, since you are not queuing use proxy map – provides read-only table lookup service to all Postfix processes check_recipient_access proxy:ldap:/etc/postfix/ldap-recip-check.cf
  • 15. Postfix / LDAP integration
  • 16. Postfix Bump up default limits # The maximal number of parallel deliveries to the same destination via the relay message delivery transport. Default is 20. relay_destination_concurrency_limit = 100 # let more than the default number of daemons run, so we can handle more simultaneous inbound connections default_process_limit = 512
  • 17. GLD Greylisting service written in C Why GLD? Inherited it with project – Checking out sqlgrey Only two SQL tables, horribly inefficient Allows for greylisting a /24 instead of each IP – needed for clusters After x successful mails the sender/IP combo is trusted and not greylisted – helps for legitimate bulk mail Be sure to check out whitelist on greylist.org and whitelist time sensitive sites, like eBay. check_policy_service inet:127.0.0.1:2525 in your main.cf
  • 18. GLD
  • 19. GLD Performance Tuning Upped max connections – this has a direct relation to DB access Changed DB to use InnoDB for row level locking Changed table to use varchar instead of char Tuned the DB's extensively to handle large InnoDB tables Used a private gigE network for DB traffic
  • 20. GLD Results 60% of mail greylisted did not come back Less mail for the more hardware intensive antivirus checking and spam tagging Less mail for the mail delivery system to store
  • 21. amavisd-new / ClamAV RFC Checking / Antivirus amavisd-new does some RFC checking, such as <> around addresses amavisd-new calls clamav pre-queue This allows for quick response and avoids backscatter at the expense of having fast antivirus machines that can keep up with the mail load postfix's master.cf # use a proxy_filter instead of a content filter so that the mail does not have to be queued  smtp inet n - - - - smtpd  -o smtpd_proxy_filter=localhost:10024  -o smtp_data_done_timeout=1200
  • 22. amavisd-new / ClamAV Performance Tuning Bump up simultaneous servers $max_servers = 16; # default is 2 Each amavisd process is using about 20MB of memory One clamav process that uses about 300MB of memory Shared memory mount for /var/lib/amavis cuts way down on disk IO. Ours is 400MB, make sure that yours is large enough or amavis with barf on you and cause a cascade effect
  • 23. amavisd-new / ClamAV First line is important to scan entire message and catch phishing @keep_decoded_original_maps = (new_RE( qr'^MAIL$', # retain full original message for virus checking (can be slow) qr'^MAIL-UNDECIPHERABLE$', # recheck full mail if it contains undecipherables qr'^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)'i, ));
  • 24. DNS queries Mail lookups generate a lot of DNS traffic We have caching DNS servers on the DB servers each perim box points to these machines over the private network you could run a caching dns server on each perim box if memory allows
  • 25. Graphs are good Keep stats We use cacti to graph stats from the mail servers Messages received, SMTP connections, viruses found, queue size, and more Graphs are not only informative, they also aid in troubleshooting
  • 26. Graphs are good Cacti graphs Messages received over a week period
  • 27. Graphs are good Cacti graphs Messages greylisted over a week period
  • 28. Graphs are good Cacti graphs Queue size over a week period
  • 29. Load Testing Load test before putting service into production Step 1: determine the load of the current system Step 2: attempt to simulate current load on new system Step 3: analyze test results to validate that new system can handle the load
  • 30. Load Testing Postfix includes handy mail load testing tools We used smtp-source and smtp-sink included with Postfix smtp-source generates mail, smtp-sink listens on port 25 and shoves messages to /dev/null We used 2 load generation boxes and 3 sink boxes. Scale this as appropriate
  • 31. Load Testing Using smtp-source/sink Start the sink: # smtp-sink -c mailsink1:25 10000 Start the source: # smtp-source -c -m -l 512 -m 1000 -s 10 localhost:25 start 10 threads each sending 1000 512 byte messages to localhost:25
  • 32. Load Testing It's important to load test all system parts Load test all moving parts Mail servers, database servers, load balancers, LDAP, DNS queries You don't want any surprises in production!