Kamaelia Grey

K
Relevant disclosure? - Kamaelia came out of my day work @ BBC Research - Kamaelia grey came out of my personal frustration, and has nothing to do with the BBC :-) Michael Sparks ,  [email_address] Kamaelia Grey
Drastic  Spam reduction through Greylisting Greylisting made easy through natural concurrency Natural concurrency made easy through Kamaelia ... since that's what Kamaelia is  for Kamaelia Grey
Problem? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Kamaelia ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Greylisting 1 ,[object Object],[object Object],[object Object],I CAN HAZ ACCEPT ALL UR EMAIL
Greylisting ,[object Object],[object Object],[object Object],KTHXBYE
Greylisting ,[object Object],[object Object]
Greylisting ,[object Object],[object Object],[object Object],I CAN HAZ ACCEPT ALL UR EMAIL
Greylisting ,[object Object],[object Object],[object Object],KTHXBYE
Where?
Here!
Requirements ,[object Object],[object Object],[object Object],[object Object],[object Object]
Mail serving UNTRUSTED INTERNET
Mail serving UNTRUSTED INTERNET MAIL SERVER 25
Mail serving UNTRUSTED INTERNET MAIL SERVER 25
Mail serving UNTRUSTED INTERNET MAIL SERVER 25
Greylisting UNTRUSTED INTERNET MAIL SERVER 8025
Greylisting UNTRUSTED INTERNET MAIL SERVER 8025 Kam Grey 25
Greylisting UNTRUSTED INTERNET MAIL SERVER 8025 Kam Grey 25
Installing ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic config port = 25 servername = mail.cerenity.org serverid = Kamaelia-SMTP 1.0 smtp_ip = 192.168.2.9 smtp_port = 8025 inactivity_timeout = 60 greylist_log = /var/log/greylist.log greylist_debuglog = /var/log/greylist-debug.log attempters_db = /var/spool/attempters.dbm greylisted_db = /var/spool/greylisted.dbm
Local config allowed_senders: 127.0.0.1 allowed_sender_nets: 192.168.2 allowed_domains: private.thwackety.com thwackety.com thwackety.net yeoldeclue.com michaelsparks.info lansdowneresidents.org polinasparks.com pixienest.com kamaelia.org owiki.org cerenity.org
Exceptions # Standard triples which always allows delivery to domains we consider # accepting for. # # Format: #  IP address, mail-from id, recipient id # whitelisted_triples: 213.38.186.202 <post@mx1.redcats.co.uk> <polina@thwackety.com>
Exceptions # Some non-standard triples for which we always allow delivery # to domains we consider accepting for. # Format: #  claimed sender name, IP prefix, recipient # whitelisted_nonstandard_triples: listmail.artsfb.org.uk 62.73.155.19 <polina@thwackety.com> mx-out.facebook.com 204.15.20 <ms@cerenity.org> mx-out.facebook.com 204.15.20 <polina@cerenity.org> fallbackmx-out.facebook.com 204.15.20 <ms@cerenity.org> fallbackmx-out.facebook.com 204.15.20 <polina@cerenity.org>
Logging? Standard log: /var/log/greylist.log 20071106172215.940 | dsl88.241-20782.ttnet.net.tr | 88.241.81.46 | <linhotepmet@hotep.de> | <ms@cerenity.org> |  DEFERRED  | 20071106172231.269 | dsl88.241-20782.ttnet.net.tr | 88.241.81.46 | <linkinosoftmet@kinosoft.de> | <ms@cerenity.org> |  DEFERRED  | 20071106172238.610 | 34-148.privatnet.cz | 88.146.148.34 | <ggybaseh@walla.com> | <messages@cerenity.org> |  DEFERRED  | 20071106172244.333 | dsl88.241-20782.ttnet.net.tr | 88.241.81.46 | <linlinasolutionsmet@linasolutions.de> | <ms@cerenity.org> |  DEFERRED  | 20071106172247.885 | mta410.k.cheetahmail.com | 208.49.63.136 | <bo-b00hg7jaukqbyva8zuwb9b9y5ph44j@b.emails.dixons.co.uk> | <zathras-pcworld@thwackety.com> |  ACCEPTED  |
Logging? Debug log: /var/log/greylist.log 250 OK 250 ACCEPTED 451 4.7.1 Please try again later 220 mail.cerenity.org ESMTP Kamaelia-SMTP 1.0 Tue Nov  6 17:26:01 2007 500 Command Not Recognised 250 mail.cerenity.org Hello lse 89.252.24.7 250 OK Note – this is what's being sent over SMTP
But also... Debug log: /var/log/greylist-debug.log *debug* THREADS['Kamaelia.Chassis.Pipeline.Pipeline_7', 'Kamaelia.Internet.Selector.Selector_11', '__main__.GreylistServer_8', '__main__.PeriodicWakeup_5', '__main__.TCPS_10', '__main__.WakeableIntrospector_6'] Note – this says the current internal components running
Internals Debug log: /var/log/greylist-debug.log ['Kamaelia.Chassis.Pipeline.Pipeline_7',  'Kamaelia.Internet.Selector.Selector_11',  '__main__.GreylistServer_8',  '__main__.PeriodicWakeup_5',  '__main__.TCPS_10',  '__main__.WakeableIntrospector_6'] Note – this says the current internal components running
Internals Debug log: /var/log/greylist-debug.log Kamaelia.Internet.Selector.Selector_11  – wakes system on network events __main__.TCPS_10  – sits inside and handles listening for '__main__.GreylistServer_8  – A configured network server Kamaelia.Chassis.Pipeline.Pipeline_7  – For debugging '__main__.PeriodicWakeup_5  – For debugging '__main__.WakeableIntrospector_6  – For debugging Note – this says the current internal components running
No connection! TCPServer Greylist Server Selector
New connection! TCPServer Greylist Server Selector Connected Socket Adapter GreyListing Policy
More connections! TCPServer Greylist Server Selector Connected Socket Adapter GreyListing Policy Connected Socket Adapter GreyListing Policy Connected Socket Adapter GreyListing Policy Connected Socket Adapter GreyListing Policy
Accepted! GreyListing Policy TCPClient Connected Socket Adapter MAIL SERVER 8025
Rejected! Connected Socket Adapter GreyListing Policy
Greylisting GreyListing Policy Concrete Mail Handler Mail Handler
Internals The following pages are intended as a walk through of the key highlights of the code-base. It skips the body of the code since that's best looked at by scrolling through code and chatting rather than dumping into slides. In a presentation its easy to say this, and then after going through slides giving road pointers go through the code. Presentation files are a little more limited. The code referred to is here:  http://tinyurl.com/2sbjxl
Internals class MailHandler(Axon.Component.component): logfile = &quot;greylist.log&quot; debuglogfile = &quot;greylist-debug.log&quot;
Internals class MailHandler(Axon.Component.component): def __init__(self,**argd): def logging_recv_connection(self): def getline(self): def handleCommand(self,command): def noteToLog(self, line): def noteToDebugLog(self, line): def netPrint(self, *args): def lastline(self): def main(self):
Internals class ConcreteMailHandler(MailHandler): Inboxes = { &quot;inbox&quot; : &quot;Data from the client connecting to the server comes in here&quot;, &quot;control&quot; : &quot;Shutdown & control messages regarding client side socket handling&quot;, &quot;tcp_inbox&quot; : &quot;This is where we get respones from the real SMTP server&quot;, &quot;tcp_control&quot; : &quot;This is where we get shutdown information from the real SMTP server&quot;, } Outboxes = { &quot;outbox&quot; : &quot;Data sent here goes back the the client connecting to the server&quot;, &quot;signal&quot; : &quot;Shutdown & control messages regarding client side socket handling&quot;, &quot;tcp_outbox&quot; : &quot;Data sent here is sent to the real SMTP server&quot;, &quot;tcp_signal&quot; : &quot;We send messages here to shutdown the connection to the real SMTP connection&quot;, } peer = &quot;*** UNDEFINED ***&quot; peerport = &quot;*** UNDEFINED ***&quot; local = &quot;*** UNDEFINED ***&quot; localport = &quot;*** UNDEFINED ***&quot; servername = &quot;Testing.server.local&quot; serverid = &quot;MPS SMTP 1.0&quot; smtp_ip = &quot;192.168.2.9&quot; smtp_port = 25
Internals class ConcreteMailHandler(MailHandler): def connectToRealSMTPServer(self): def __init__(self, **argv): def error(self, message):  def RelayError(self): def handleConnect(self): def handleEhlo(self,command): def handleHelo(self,command): def handleHelp(self,command): def handleVrfy(self,command): def handleRset(self,command): def handleNoop(self,command): def handleMail(self,command): def handleRcpt(self,command): def handleData(self, command): def handleQuit(self,command): def shouldWeAcceptMail(self): return False # Default policy - don't accept any email def deferMail(self): def acceptMail(self): def getline_fromsmtpserver(self): def handleDisconnect(self):
Internals class GreyListingPolicy(ConcreteMailHandler): allowed_senders = [] allowed_sender_nets = [] allowed_domains = [ ]
Internals class GreyListingPolicy(ConcreteMailHandler): (continued) def shouldWeAcceptMail(self): def sentFromAllowedIPAddress(self): def sentFromAllowedNetwork(self): def sentToADomainWeForwardFor(self): def isGreylisted(self, recipient): def whiteListed(self, recipient): def logResult(self):
Internals class GreylistServer(MoreComplexServer): logfile = config[&quot;greylist_log&quot;] debuglogfile = config[&quot;greylist_debuglog&quot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) port = config[&quot;port&quot;] class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter,   timeout=config[&quot;inactivity_timeout&quot;], debug=False) ....
Internals class GreylistServer(MoreComplexServer): (continued) # ... class protocol(GreyListingPolicy): servername = config[&quot;servername&quot;] serverid = config[&quot;serverid&quot;] smtp_ip = config[&quot;smtp_ip&quot;] smtp_port = config[&quot;smtp_port&quot;] allowed_senders = config[&quot;allowed_senders&quot;] allowed_sender_nets = config[&quot;allowed_sender_nets&quot;]  allowed_domains = config[&quot;allowed_domains&quot;] whitelisted_triples = config[&quot;whitelisted_triples&quot;] whitelisted_nonstandard_triples =  config[&quot;whitelisted_nonstandard_triples&quot;]
And that... Saves me having to wade through now literally tens of thousands of spams over the past two months: # grep DEFERRED /var/log/greylist.log |wc -l 73798
Time to write? 2 days start to finish including protocol Bug fixes ~1-2 days tops
Questions? Thank you :-) I hope it's useful to you :)
1 of 47

Recommended

Office 365 Message Encryption by
Office 365 Message EncryptionOffice 365 Message Encryption
Office 365 Message EncryptionJoel Brda
1.1K views48 slides
_.com_To_.co.in_Doc.docx by
_.com_To_.co.in_Doc.docx_.com_To_.co.in_Doc.docx
_.com_To_.co.in_Doc.docxAkshay Sahatpure
7 views1 slide
Upgrading to php 5.6 by
Upgrading to php 5.6Upgrading to php 5.6
Upgrading to php 5.6Luka Skupnjak
938 views15 slides
How to prevent dns leak through vpn by
How to prevent dns leak through vpnHow to prevent dns leak through vpn
How to prevent dns leak through vpnLime VPN
72 views8 slides
Building a social network in under 4 weeks with Serverless and GraphQL by
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLYan Cui
289 views153 slides
Spam Wars by
Spam WarsSpam Wars
Spam WarsMaurice Green
5.3K views69 slides

More Related Content

Viewers also liked

Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia by
Timeshift Everything, Miss Nothing - Mashup your PVR with KamaeliaTimeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaeliakamaelian
1.3K views85 slides
The Selfish Programmer by
The Selfish ProgrammerThe Selfish Programmer
The Selfish Programmerkamaelian
738 views8 slides
Managing Creativity by
Managing CreativityManaging Creativity
Managing Creativitykamaelian
1.1K views29 slides
Embracing concurrency for fun utility and simpler code by
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler codekamaelian
1.1K views20 slides
Kamaelia Protocol Walkthrough by
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthroughkamaelian
3.4K views50 slides
Kamaelia Europython Tutorial by
Kamaelia Europython TutorialKamaelia Europython Tutorial
Kamaelia Europython Tutorialkamaelian
1.7K views158 slides

Viewers also liked(20)

Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia by kamaelian
Timeshift Everything, Miss Nothing - Mashup your PVR with KamaeliaTimeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
kamaelian1.3K views
The Selfish Programmer by kamaelian
The Selfish ProgrammerThe Selfish Programmer
The Selfish Programmer
kamaelian738 views
Managing Creativity by kamaelian
Managing CreativityManaging Creativity
Managing Creativity
kamaelian1.1K views
Embracing concurrency for fun utility and simpler code by kamaelian
Embracing concurrency for fun utility and simpler codeEmbracing concurrency for fun utility and simpler code
Embracing concurrency for fun utility and simpler code
kamaelian1.1K views
Kamaelia Protocol Walkthrough by kamaelian
Kamaelia Protocol WalkthroughKamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
kamaelian3.4K views
Kamaelia Europython Tutorial by kamaelian
Kamaelia Europython TutorialKamaelia Europython Tutorial
Kamaelia Europython Tutorial
kamaelian1.7K views
Kamaelia lightning2010opensource by kamaelian
Kamaelia lightning2010opensourceKamaelia lightning2010opensource
Kamaelia lightning2010opensource
kamaelian1.1K views
RabbitMQ with python and ruby RuPy 2009 by Paolo Negri
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009
Paolo Negri5.9K views
Practical concurrent systems made simple using Kamaelia by kamaelian
Practical concurrent systems made simple using KamaeliaPractical concurrent systems made simple using Kamaelia
Practical concurrent systems made simple using Kamaelia
kamaelian2.2K views
Messaging with RabbitMQ and AMQP by Eberhard Wolff
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
Eberhard Wolff13.5K views
Data Analysis and Statistics in Python using pandas and statsmodels by Wes McKinney
Data Analysis and Statistics in Python using pandas and statsmodelsData Analysis and Statistics in Python using pandas and statsmodels
Data Analysis and Statistics in Python using pandas and statsmodels
Wes McKinney19.8K views
Django for Beginners by Jason Davies
Django for BeginnersDjango for Beginners
Django for Beginners
Jason Davies13.1K views
Introduction To Django by Jay Graves
Introduction To DjangoIntroduction To Django
Introduction To Django
Jay Graves14.4K views
Python for Financial Data Analysis with pandas by Wes McKinney
Python for Financial Data Analysis with pandasPython for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandas
Wes McKinney61.8K views
Advance OOP concepts in Python by Sujith Kumar
Advance OOP concepts in PythonAdvance OOP concepts in Python
Advance OOP concepts in Python
Sujith Kumar19.3K views
Python Advanced – Building on the foundation by Kevlin Henney
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundation
Kevlin Henney154K views
Python Tricks That You Can't Live Without by Audrey Roy
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
Audrey Roy29.6K views
Improving Python and Spark Performance and Interoperability: Spark Summit Eas... by Spark Summit
Improving Python and Spark Performance and Interoperability: Spark Summit Eas...Improving Python and Spark Performance and Interoperability: Spark Summit Eas...
Improving Python and Spark Performance and Interoperability: Spark Summit Eas...
Spark Summit2.5K views

Similar to Kamaelia Grey

Konsep pembangunan tapak web & laman web by
Konsep pembangunan tapak web & laman webKonsep pembangunan tapak web & laman web
Konsep pembangunan tapak web & laman webAhmad Faizar
2.9K views81 slides
Applications.docx by
Applications.docxApplications.docx
Applications.docxssuserf7cd2b
6 views14 slides
Real-time Ruby for the Real-time Web by
Real-time Ruby for the Real-time WebReal-time Ruby for the Real-time Web
Real-time Ruby for the Real-time WebIlya Grigorik
17.8K views71 slides
CoLabora - Exchange Online Protection - June 2015 by
CoLabora - Exchange Online Protection - June 2015 CoLabora - Exchange Online Protection - June 2015
CoLabora - Exchange Online Protection - June 2015 CoLaboraDK
1.4K views41 slides
Smit WiFi_2 by
Smit WiFi_2Smit WiFi_2
Smit WiFi_2mutew
727 views46 slides
EmailTracing.ppt by
EmailTracing.pptEmailTracing.ppt
EmailTracing.pptgovindanonymous143
0 views27 slides

Similar to Kamaelia Grey(20)

Konsep pembangunan tapak web & laman web by Ahmad Faizar
Konsep pembangunan tapak web & laman webKonsep pembangunan tapak web & laman web
Konsep pembangunan tapak web & laman web
Ahmad Faizar2.9K views
Real-time Ruby for the Real-time Web by Ilya Grigorik
Real-time Ruby for the Real-time WebReal-time Ruby for the Real-time Web
Real-time Ruby for the Real-time Web
Ilya Grigorik17.8K views
CoLabora - Exchange Online Protection - June 2015 by CoLaboraDK
CoLabora - Exchange Online Protection - June 2015 CoLabora - Exchange Online Protection - June 2015
CoLabora - Exchange Online Protection - June 2015
CoLaboraDK1.4K views
Smit WiFi_2 by mutew
Smit WiFi_2Smit WiFi_2
Smit WiFi_2
mutew727 views
How to deploy Exchange Online Protection by Peter Schmidt
How to deploy Exchange Online ProtectionHow to deploy Exchange Online Protection
How to deploy Exchange Online Protection
Peter Schmidt5.9K views
Cyber security and ethical hacking 3 by Mehedi Hasan
Cyber security and ethical hacking 3Cyber security and ethical hacking 3
Cyber security and ethical hacking 3
Mehedi Hasan298 views
B2B Email Deliverability - Getting to the Inbox by B2BCamp
B2B Email Deliverability - Getting to the InboxB2B Email Deliverability - Getting to the Inbox
B2B Email Deliverability - Getting to the Inbox
B2BCamp1.6K views
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ... by CODE BLUE
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages! ...
CODE BLUE2K views
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo... by Chanaka Lasantha
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Chanaka Lasantha24 views
Astricon 2010: Scaling Asterisk installations by Olle E Johansson
Astricon 2010: Scaling Asterisk installationsAstricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installations
Olle E Johansson3.9K views
siemens-tcp-ip-ethernet-manual.pdf by TestGg1
siemens-tcp-ip-ethernet-manual.pdfsiemens-tcp-ip-ethernet-manual.pdf
siemens-tcp-ip-ethernet-manual.pdf
TestGg17 views
Practical webRTC - from API to Solution - webRTC Summit 2014 @ NYC by Alexandre Gouaillard
Practical webRTC - from API to Solution - webRTC Summit 2014 @ NYCPractical webRTC - from API to Solution - webRTC Summit 2014 @ NYC
Practical webRTC - from API to Solution - webRTC Summit 2014 @ NYC
Teflon - Anti Stick for the browser attack surface by Saumil Shah
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surface
Saumil Shah2.2K views

More from kamaelian

Sharing Data and Services Safely in Concurrent Systems using Kamaelia by
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaeliakamaelian
4.4K views62 slides
Sociable Software by
Sociable SoftwareSociable Software
Sociable Softwarekamaelian
1.4K views79 slides
Open Source at the BBC: When, Why, Why not & How by
Open Source at the BBC: When, Why, Why not & HowOpen Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & Howkamaelian
1.1K views155 slides
Open Source at the BBC by
Open Source at the BBCOpen Source at the BBC
Open Source at the BBCkamaelian
8.8K views18 slides
Kamaelia - Fave 2005 by
Kamaelia - Fave 2005Kamaelia - Fave 2005
Kamaelia - Fave 2005kamaelian
591 views28 slides
SWP - A Generic Language Parser by
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parserkamaelian
1.4K views13 slides

More from kamaelian(11)

Sharing Data and Services Safely in Concurrent Systems using Kamaelia by kamaelian
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
kamaelian4.4K views
Sociable Software by kamaelian
Sociable SoftwareSociable Software
Sociable Software
kamaelian1.4K views
Open Source at the BBC: When, Why, Why not & How by kamaelian
Open Source at the BBC: When, Why, Why not & HowOpen Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & How
kamaelian1.1K views
Open Source at the BBC by kamaelian
Open Source at the BBCOpen Source at the BBC
Open Source at the BBC
kamaelian8.8K views
Kamaelia - Fave 2005 by kamaelian
Kamaelia - Fave 2005Kamaelia - Fave 2005
Kamaelia - Fave 2005
kamaelian591 views
SWP - A Generic Language Parser by kamaelian
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
kamaelian1.4K views
Kamaelia - Networking Using Generators by kamaelian
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
kamaelian1.8K views
Scaling Streaming - Concepts, Research, Goals by kamaelian
Scaling Streaming - Concepts, Research, GoalsScaling Streaming - Concepts, Research, Goals
Scaling Streaming - Concepts, Research, Goals
kamaelian765 views
Kamaelia Internals by kamaelian
Kamaelia InternalsKamaelia Internals
Kamaelia Internals
kamaelian674 views
Building systems with Kamaelia by kamaelian
Building systems with KamaeliaBuilding systems with Kamaelia
Building systems with Kamaelia
kamaelian882 views
Free software: How does it work? by kamaelian
Free software: How does it work?Free software: How does it work?
Free software: How does it work?
kamaelian626 views

Recently uploaded

Throughput by
ThroughputThroughput
ThroughputMoisés Armani Ramírez
36 views11 slides
The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
121 views24 slides
[2023] Putting the R! in R&D.pdf by
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdfEleanor McHugh
38 views127 slides
Web Dev - 1 PPT.pdf by
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdfgdsczhcet
55 views45 slides
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze by
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng TszeDigital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng TszeNUS-ISS
19 views47 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
17 views1 slide

Recently uploaded(20)

The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 views
[2023] Putting the R! in R&D.pdf by Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 views
Web Dev - 1 PPT.pdf by gdsczhcet
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet55 views
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze by NUS-ISS
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng TszeDigital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
NUS-ISS19 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman27 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 views
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by Splunk
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk88 views
Data-centric AI and the convergence of data and model engineering: opportunit... by Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software225 views
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb12 views
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... by Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin75 views
Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica... by NUS-ISS
Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica...Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica...
Emerging & Future Technology - How to Prepare for the Next 10 Years of Radica...
NUS-ISS16 views
Perth MeetUp November 2023 by Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu... by NUS-ISS
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
Architecting CX Measurement Frameworks and Ensuring CX Metrics are fit for Pu...
NUS-ISS37 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab15 views

Kamaelia Grey

  • 1. Relevant disclosure? - Kamaelia came out of my day work @ BBC Research - Kamaelia grey came out of my personal frustration, and has nothing to do with the BBC :-) Michael Sparks , [email_address] Kamaelia Grey
  • 2. Drastic Spam reduction through Greylisting Greylisting made easy through natural concurrency Natural concurrency made easy through Kamaelia ... since that's what Kamaelia is for Kamaelia Grey
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 11. Here!
  • 12.
  • 14. Mail serving UNTRUSTED INTERNET MAIL SERVER 25
  • 15. Mail serving UNTRUSTED INTERNET MAIL SERVER 25
  • 16. Mail serving UNTRUSTED INTERNET MAIL SERVER 25
  • 17. Greylisting UNTRUSTED INTERNET MAIL SERVER 8025
  • 18. Greylisting UNTRUSTED INTERNET MAIL SERVER 8025 Kam Grey 25
  • 19. Greylisting UNTRUSTED INTERNET MAIL SERVER 8025 Kam Grey 25
  • 20.
  • 21. Basic config port = 25 servername = mail.cerenity.org serverid = Kamaelia-SMTP 1.0 smtp_ip = 192.168.2.9 smtp_port = 8025 inactivity_timeout = 60 greylist_log = /var/log/greylist.log greylist_debuglog = /var/log/greylist-debug.log attempters_db = /var/spool/attempters.dbm greylisted_db = /var/spool/greylisted.dbm
  • 22. Local config allowed_senders: 127.0.0.1 allowed_sender_nets: 192.168.2 allowed_domains: private.thwackety.com thwackety.com thwackety.net yeoldeclue.com michaelsparks.info lansdowneresidents.org polinasparks.com pixienest.com kamaelia.org owiki.org cerenity.org
  • 23. Exceptions # Standard triples which always allows delivery to domains we consider # accepting for. # # Format: # IP address, mail-from id, recipient id # whitelisted_triples: 213.38.186.202 <post@mx1.redcats.co.uk> <polina@thwackety.com>
  • 24. Exceptions # Some non-standard triples for which we always allow delivery # to domains we consider accepting for. # Format: # claimed sender name, IP prefix, recipient # whitelisted_nonstandard_triples: listmail.artsfb.org.uk 62.73.155.19 <polina@thwackety.com> mx-out.facebook.com 204.15.20 <ms@cerenity.org> mx-out.facebook.com 204.15.20 <polina@cerenity.org> fallbackmx-out.facebook.com 204.15.20 <ms@cerenity.org> fallbackmx-out.facebook.com 204.15.20 <polina@cerenity.org>
  • 25. Logging? Standard log: /var/log/greylist.log 20071106172215.940 | dsl88.241-20782.ttnet.net.tr | 88.241.81.46 | <linhotepmet@hotep.de> | <ms@cerenity.org> | DEFERRED | 20071106172231.269 | dsl88.241-20782.ttnet.net.tr | 88.241.81.46 | <linkinosoftmet@kinosoft.de> | <ms@cerenity.org> | DEFERRED | 20071106172238.610 | 34-148.privatnet.cz | 88.146.148.34 | <ggybaseh@walla.com> | <messages@cerenity.org> | DEFERRED | 20071106172244.333 | dsl88.241-20782.ttnet.net.tr | 88.241.81.46 | <linlinasolutionsmet@linasolutions.de> | <ms@cerenity.org> | DEFERRED | 20071106172247.885 | mta410.k.cheetahmail.com | 208.49.63.136 | <bo-b00hg7jaukqbyva8zuwb9b9y5ph44j@b.emails.dixons.co.uk> | <zathras-pcworld@thwackety.com> | ACCEPTED |
  • 26. Logging? Debug log: /var/log/greylist.log 250 OK 250 ACCEPTED 451 4.7.1 Please try again later 220 mail.cerenity.org ESMTP Kamaelia-SMTP 1.0 Tue Nov 6 17:26:01 2007 500 Command Not Recognised 250 mail.cerenity.org Hello lse 89.252.24.7 250 OK Note – this is what's being sent over SMTP
  • 27. But also... Debug log: /var/log/greylist-debug.log *debug* THREADS['Kamaelia.Chassis.Pipeline.Pipeline_7', 'Kamaelia.Internet.Selector.Selector_11', '__main__.GreylistServer_8', '__main__.PeriodicWakeup_5', '__main__.TCPS_10', '__main__.WakeableIntrospector_6'] Note – this says the current internal components running
  • 28. Internals Debug log: /var/log/greylist-debug.log ['Kamaelia.Chassis.Pipeline.Pipeline_7', 'Kamaelia.Internet.Selector.Selector_11', '__main__.GreylistServer_8', '__main__.PeriodicWakeup_5', '__main__.TCPS_10', '__main__.WakeableIntrospector_6'] Note – this says the current internal components running
  • 29. Internals Debug log: /var/log/greylist-debug.log Kamaelia.Internet.Selector.Selector_11 – wakes system on network events __main__.TCPS_10 – sits inside and handles listening for '__main__.GreylistServer_8 – A configured network server Kamaelia.Chassis.Pipeline.Pipeline_7 – For debugging '__main__.PeriodicWakeup_5 – For debugging '__main__.WakeableIntrospector_6 – For debugging Note – this says the current internal components running
  • 30. No connection! TCPServer Greylist Server Selector
  • 31. New connection! TCPServer Greylist Server Selector Connected Socket Adapter GreyListing Policy
  • 32. More connections! TCPServer Greylist Server Selector Connected Socket Adapter GreyListing Policy Connected Socket Adapter GreyListing Policy Connected Socket Adapter GreyListing Policy Connected Socket Adapter GreyListing Policy
  • 33. Accepted! GreyListing Policy TCPClient Connected Socket Adapter MAIL SERVER 8025
  • 34. Rejected! Connected Socket Adapter GreyListing Policy
  • 35. Greylisting GreyListing Policy Concrete Mail Handler Mail Handler
  • 36. Internals The following pages are intended as a walk through of the key highlights of the code-base. It skips the body of the code since that's best looked at by scrolling through code and chatting rather than dumping into slides. In a presentation its easy to say this, and then after going through slides giving road pointers go through the code. Presentation files are a little more limited. The code referred to is here: http://tinyurl.com/2sbjxl
  • 37. Internals class MailHandler(Axon.Component.component): logfile = &quot;greylist.log&quot; debuglogfile = &quot;greylist-debug.log&quot;
  • 38. Internals class MailHandler(Axon.Component.component): def __init__(self,**argd): def logging_recv_connection(self): def getline(self): def handleCommand(self,command): def noteToLog(self, line): def noteToDebugLog(self, line): def netPrint(self, *args): def lastline(self): def main(self):
  • 39. Internals class ConcreteMailHandler(MailHandler): Inboxes = { &quot;inbox&quot; : &quot;Data from the client connecting to the server comes in here&quot;, &quot;control&quot; : &quot;Shutdown & control messages regarding client side socket handling&quot;, &quot;tcp_inbox&quot; : &quot;This is where we get respones from the real SMTP server&quot;, &quot;tcp_control&quot; : &quot;This is where we get shutdown information from the real SMTP server&quot;, } Outboxes = { &quot;outbox&quot; : &quot;Data sent here goes back the the client connecting to the server&quot;, &quot;signal&quot; : &quot;Shutdown & control messages regarding client side socket handling&quot;, &quot;tcp_outbox&quot; : &quot;Data sent here is sent to the real SMTP server&quot;, &quot;tcp_signal&quot; : &quot;We send messages here to shutdown the connection to the real SMTP connection&quot;, } peer = &quot;*** UNDEFINED ***&quot; peerport = &quot;*** UNDEFINED ***&quot; local = &quot;*** UNDEFINED ***&quot; localport = &quot;*** UNDEFINED ***&quot; servername = &quot;Testing.server.local&quot; serverid = &quot;MPS SMTP 1.0&quot; smtp_ip = &quot;192.168.2.9&quot; smtp_port = 25
  • 40. Internals class ConcreteMailHandler(MailHandler): def connectToRealSMTPServer(self): def __init__(self, **argv): def error(self, message): def RelayError(self): def handleConnect(self): def handleEhlo(self,command): def handleHelo(self,command): def handleHelp(self,command): def handleVrfy(self,command): def handleRset(self,command): def handleNoop(self,command): def handleMail(self,command): def handleRcpt(self,command): def handleData(self, command): def handleQuit(self,command): def shouldWeAcceptMail(self): return False # Default policy - don't accept any email def deferMail(self): def acceptMail(self): def getline_fromsmtpserver(self): def handleDisconnect(self):
  • 41. Internals class GreyListingPolicy(ConcreteMailHandler): allowed_senders = [] allowed_sender_nets = [] allowed_domains = [ ]
  • 42. Internals class GreyListingPolicy(ConcreteMailHandler): (continued) def shouldWeAcceptMail(self): def sentFromAllowedIPAddress(self): def sentFromAllowedNetwork(self): def sentToADomainWeForwardFor(self): def isGreylisted(self, recipient): def whiteListed(self, recipient): def logResult(self):
  • 43. Internals class GreylistServer(MoreComplexServer): logfile = config[&quot;greylist_log&quot;] debuglogfile = config[&quot;greylist_debuglog&quot;] socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) port = config[&quot;port&quot;] class TCPS(TCPServer): CSA = NoActivityTimeout(ConnectedSocketAdapter, timeout=config[&quot;inactivity_timeout&quot;], debug=False) ....
  • 44. Internals class GreylistServer(MoreComplexServer): (continued) # ... class protocol(GreyListingPolicy): servername = config[&quot;servername&quot;] serverid = config[&quot;serverid&quot;] smtp_ip = config[&quot;smtp_ip&quot;] smtp_port = config[&quot;smtp_port&quot;] allowed_senders = config[&quot;allowed_senders&quot;] allowed_sender_nets = config[&quot;allowed_sender_nets&quot;] allowed_domains = config[&quot;allowed_domains&quot;] whitelisted_triples = config[&quot;whitelisted_triples&quot;] whitelisted_nonstandard_triples = config[&quot;whitelisted_nonstandard_triples&quot;]
  • 45. And that... Saves me having to wade through now literally tens of thousands of spams over the past two months: # grep DEFERRED /var/log/greylist.log |wc -l 73798
  • 46. Time to write? 2 days start to finish including protocol Bug fixes ~1-2 days tops
  • 47. Questions? Thank you :-) I hope it's useful to you :)