Using BGP for realtime import and export of OpenBSD spamd entries - - PowerPoint PPT Presentation

using bgp for realtime import and export of openbsd spamd
SMART_READER_LITE
LIVE PREVIEW

Using BGP for realtime import and export of OpenBSD spamd entries - - PowerPoint PPT Presentation

Using BGP for realtime import and export of OpenBSD spamd entries Peter Hessler phessler@openbsd.org OpenBSD 17 March, 2013 1 / 27 what is this spamd uses IP host entries, to whitelist, blacklist or greylist hosts spamd can import and


slide-1
SLIDE 1

Using BGP for realtime import and export of OpenBSD spamd entries

Peter Hessler

phessler@openbsd.org

OpenBSD

17 March, 2013

1 / 27

slide-2
SLIDE 2

what is this

spamd uses IP host entries, to whitelist, blacklist or greylist hosts spamd can import and export these lists trivia: IP host entries can be represented as a route bgp is used to distribute IP route lists tie the two together, to simplify distributing these addresses

2 / 27

slide-3
SLIDE 3

spamd

written by Bob Beck included in OpenBSD since 3.3, greylisting added in 3.5 uses greylisting to force unknown senders to retry delivery (very effective against bot-nets sending spam) uses blacklisting to reject mail from “known bad” senders fetches blacklists at the top of the hour from a web server

3 / 27

slide-4
SLIDE 4

bgp

bgp is the glue that holds the internet together used to distribute the 400k+ IPv4 routes of the Global Routing Table scales incredibly high, and incredibly fast very minor feature called “communities” that we will exploit

4 / 27

slide-5
SLIDE 5

bgp communities

allows you to mark a route with optional site-specific attributes bgp peers can use this to make arbitrary decisions on received routes route: 192.0.2.55/32 community: 65066:42 this is our “secret sauce”

5 / 27

slide-6
SLIDE 6
  • penbgpd

written by Henning Brauer and Claudio Jeker included in OpenBSD since 3.5 software based, so we can use the power of a general purpose OS ...like scripting. or cron.

6 / 27

slide-7
SLIDE 7
  • penbgpd

everything we use is already built-in to both spamd and bgpd, or are

  • ur custom scripts.

...the ability to use “long” pf table names will be in the 5.3 release

7 / 27

slide-8
SLIDE 8

tying them together

so, lets start to tie them together export IP address lists import IP address lists

8 / 27

slide-9
SLIDE 9

tying them together

exporting IP addresses happens on the “spamd-source” systems.

  • nly list the specific IP addresses that exhibited a specific behaviour

do NOT penalize network neighbors

9 / 27

slide-10
SLIDE 10

spamd-source

“spamd-source” systems insert IP addresses to our feed really simplistic, we just want to catch the low-hanging-fruit

10 / 27

slide-11
SLIDE 11

spamd-source

first, select known good upstream sources be conservative don’t whitelist the world don’t blacklist the world greylisting is powerful, when it still applies!

11 / 27

slide-12
SLIDE 12

spamd-source blacklist

listed IP address sent mail to a “spam trap” address blacklist timeout of 24 hours do not be overly aggressive

bgpctl network add 192.0.2.20/32 community 65066:666

12 / 27

slide-13
SLIDE 13

spamd-source whitelist

semi-trusted email servers higher entry bar than normal spamd whitelist in the whitelist for 75 days, and sent more than 10 emails again, do not be overly aggressive

bgpctl network add 192.0.2.55/32 community 65066:42

13 / 27

slide-14
SLIDE 14

route server

the center of our universe receives routes and communities from the spamd-source systems redistributes them to client/peers

14 / 27

slide-15
SLIDE 15

route server

  • nly accept addresses from trusted spamd-source systems
  • nly accept host routes (/32)

mark with our AS and community, for easy filtering

match from group BS community neighbor-as:42 set community $myAS:42 match from group BS community neighbor-as:666 set community $myAS:666

15 / 27

slide-16
SLIDE 16

client

receives the black and white lists separates them out, and applies the local configuration

16 / 27

slide-17
SLIDE 17

client whitelist

adds whitelist entries to a pf table allows whitelisted entries to bypass spamd receive emails faster from servers that are semi-trusted elsewhere

17 / 27

slide-18
SLIDE 18

client whitelist

$ cat /etc/pf.conf table <bgp-spamd-bypass> persist table <spamd-white> persist pass in proto tcp from any to any port smtp \ rdr-to 127.0.0.1 port spamd pass in proto tcp from <bgp-spamd-bypass> to any port smtp pass in proto tcp from <spamd-white> to any port smtp pass out proto tcp to any port smtp

18 / 27

slide-19
SLIDE 19

client blacklist

why not simply use pf to block blacklist hosts? your ceo is expecting an email from a blacklisted system tell sending servers that they are being blacklisted on purpose

19 / 27

slide-20
SLIDE 20

client blacklist

warning: Work In Progress ahead!

20 / 27

slide-21
SLIDE 21

client blacklist

$ cat /usr/local/sbin/bgp-spamd.black.sh #!/bin/sh AS=65066 bgpctl show rib community ${AS}:666 | awk ’{print $1}’ | \ sed ’s/\/.*$//’ > /var/db/spamd.black /usr/libexec/spamd-setup # EOF

21 / 27

slide-22
SLIDE 22

client blacklist

$ cat /etc/mail/spamd.conf all:\ :bgp-spamd: bgp-spamd:\ :black:\ :msg="Your address %A has sent mail to a spamtrap\n\ within the last 24 hours":\ :method=file:\ :file=/var/db/spamd.black: # EOF

22 / 27

slide-23
SLIDE 23

security concerns

where do we get the IP addresses from? what is the criteria for adding an IP address to a black or white list? how do we prevent random clients from inserting information? how does this tie in with the Global BGP Routing Table? wait, will this adjust the routes on my system/network?

23 / 27

slide-24
SLIDE 24

rs.bgp-spamd.net

this sounds interesting, can I use it? available today, at http://www.bgp-spamd.net I will run the above reference implementation for the entirety of 2013 all configurations and scripts will be available. 48457 blacklist entries 124527 whitelist entries

24 / 27

slide-25
SLIDE 25

future work

accelerate adding addresses to the bgp feed import/export of data between bgpd and spamd network aggregation

25 / 27

slide-26
SLIDE 26

Acknowledgements

Many thanks to my coauthor Bob Beck, Peter N.M. Hansteen of BSDly.net, Bob Beck of obtuse.com, the University of Alberta at ualberta.ca for being sources of spamdb information. Sonic.net for hosting the reference implementation rs.bgp-spamd.net

26 / 27

slide-27
SLIDE 27

Questions?

27 / 27