Relayd: a load-balancer for OpenBSD



Similar documents
Recent work in OpenBSD relayd AsiaBSDCon 2013 Reyk Flöter

Migrating the SSL Offloading Configuration of the Alteon Application Switch 2424-SSL to AlteonOS version

ATS Test Documentation

FortiOS Handbook - Load Balancing VERSION 5.2.2

HAProxy. Ryan O'Hara Principal Software Engineer, Red Hat September 17, HAProxy

DEPLOYMENT GUIDE Version 1.1. Deploying the BIG-IP LTM v10 with Citrix Presentation Server 4.5

ALOHA LOAD BALANCER MANAGING SSL ON THE BACKEND & FRONTEND

CumuLogic Load Balancer Overview Guide. March CumuLogic Load Balancer Overview Guide 1

Implementing Reverse Proxy Using Squid. Prepared By Visolve Squid Team

Application Note. Active Directory Federation Services deployment guide

FortiOS Handbook Load Balancing for FortiOS 5.0

Lab Exercise SSL/TLS. Objective. Step 1: Open a Trace. Step 2: Inspect the Trace

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP System v10 with Microsoft IIS 7.0 and 7.5

TESTING & INTEGRATION GROUP SOLUTION GUIDE

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP system v10 with Microsoft Exchange Outlook Web Access 2007

Firewall Load Balancing

Load Balancing. FortiOS Handbook v3 for FortiOS 4.0 MR3

using routing domains / routing tables in a production network

Firewall Load Balancing

DEPLOYMENT GUIDE DEPLOYING THE BIG-IP LTM SYSTEM WITH CITRIX PRESENTATION SERVER 3.0 AND 4.5

Managing Virtual Servers

Load Balancing Trend Micro InterScan Web Gateway

Configuring Nex-Gen Web Load Balancer

WebGUI Load Balancing

Integrated SSL Scanning

DMZ Network Visibility with Wireshark June 15, 2010

TCP Packet Tracing Part 1

DEPLOYMENT GUIDE Version 2.1. Deploying F5 with Microsoft SharePoint 2010

How To Configure SSL VPN in Cyberoam

WEBTITAN CLOUD. User Identification Guide BLOCK WEB THREATS BOOST PRODUCTIVITY REDUCE LIABILITIES

Prerequisites. Creating Profiles

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

Installation and configuration guide

Issue 2EN. Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation

DEPLOYMENT GUIDE Version 1.2. Deploying F5 with Microsoft Exchange Server 2007

SSL Inspection Step-by-Step Guide. June 6, 2016

Deployment of Services on IPv6

7 Network Security. 7.1 Introduction 7.2 Improving the Security 7.3 Internet Security Framework. 7.5 Absolute Security?

Multi-Homing Gateway. User s Manual

How to Make the Client IP Address Available to the Back-end Server

Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

S y s t e m A r c h i t e c t u r e

Load Balancing Bloxx Web Filter. Deployment Guide

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP System v9.x with Microsoft IIS 7.0 and 7.5

PAN-OS Syslog Integration

avast! for linux technical documentation

Integrated SSL Scanning

Understanding Slow Start

FreeBSD Firewalls SS- E Kevin Chege ISOC

Pexip Infinity Reverse Proxy Deployment Guide

WiNG 5.X How To. Policy Based Routing Cache Redirection. Part No. TME Rev. A

Configuring NetFlow Secure Event Logging (NSEL)

Load Balancing Sophos Web Gateway. Deployment Guide

ENABLING RPC OVER HTTPS CONNECTIONS TO M-FILES SERVER

Link Load Balancing :50:44 UTC Citrix Systems, Inc. All rights reserved. Terms of Use Trademarks Privacy Statement

Lecture 8a: WWW Proxy Servers and Cookies

DEPLOYMENT GUIDE Version 1.0. Deploying the BIG-IP LTM with Microsoft Windows Server 2008 R2 Remote Desktop Services

PRODUCT VERSION: LYNC SERVER 2010, LYNC SERVER 2013, WINDOWS SERVER 2008

Load Balancing McAfee Web Gateway. Deployment Guide

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

Outline VLAN. Inter-VLAN communication. Layer-3 Switches. Spanning Tree Protocol Recap

WAN Optimization, Web Cache, Explicit Proxy, and WCCP. FortiOS Handbook v3 for FortiOS 4.0 MR3

Configuring Health Monitoring

SuperLumin Nemesis. Administration Guide. February 2011

Lab Exercise SSL/TLS. Objective. Requirements. Step 1: Capture a Trace

Basic & Advanced Administration for Citrix NetScaler 9.2

Configuring Load Balancing

OpenBSD in the wild...a personal journey

LifeSize Transit Deployment Guide June 2011

Jason Dixon DixonGroup Consulting. September 17, 2005 NYCBSDCON 2005

Load Balancing Oracle Application Server (Oracle HTTP Server) Quick Reference Guide

F-Secure Messaging Security Gateway. Deployment Guide

Load Balance Mechanism

Load Balancing Barracuda Web Filter. Deployment Guide

Volume SYSLOG JUNCTION. User s Guide. User s Guide

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

Owner of the content within this article is Written by Marc Grote

Web Application Firewall

How to scan/exploit a ssl based webserver. by xxradar. mailto:xxradar@radarhack.com. Version 1.

Virtual private network. Network security protocols VPN VPN. Instead of a dedicated data link Packets securely sent over a shared network Internet VPN

Snapt Balancer Manual

Figure 41-1 IP Filter Rules

HOWTO: How to configure VPN SSL roadwarrior to gateway

Running the Tor client on Mac OS X

Linux Network Security

Hosting more than one FortiOS instance on. VLANs. 1. Network topology

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

I've applied for a goipv6 account and received my password via but I cannot log into my account. What should I do?

Configuring Network Address Translation

Load Balancing using Pramati Web Load Balancer

Ciphermail Gateway Separate Front-end and Back-end Configuration Guide

Load Balancing Microsoft Terminal Services. Deployment Guide

NETASQ MIGRATING FROM V8 TO V9

Internet Security Firewalls

How to install and run an OpenVPN client on your Windows-based PC

Deploying the BIG-IP LTM and APM with Citrix XenApp or XenDesktop

Linux MDS Firewall Supplement

Transcription:

Relayd: a load-balancer for OpenBSD Giovanni Bechis giovanni@openbsd.org University of Applied Sciences, Vienna, Austria May 5, 2012

what is relayd useful for? Reverse proxy Ssl accelerated reverse proxy Transparent proxy with filtering capabilities Application redirector Load balancer Wan link balancer

a short story First imported in OpenBSD 4.1 Initially it was called hoststated(8) Renamed to relayd(8) in OpenBSD 4.3 Written by pyr@ and reyk@

some relayd(8) features written with security in mind and based on imsg framework ipv4 and ipv6 capable carp(4) capable snmpd(8) integration

software anatomy Relayd is divided in a main process and 3 different engines Parent process HCE: Host check engine PFE: Pf engine Relay engine

the parent process The parent process is the only one that runs with elevated privileges, it runs as root to be able to handle: configuration files setup sockets external script execution (privileges will be dropped to relayd user before execlp function call) carp demotion requests

host check engine The Host Check Engine uses some methods to verify that the target host service is functional, before routing traffic to the host. It can use: icmp tcp ssl http/https external scripts

pf engine The Packet Filter Engine allows integration with the OpenBSD Packet Filter. Creates and destroys PF rules Updates PF tables based on HCE notifications

relay engine This engine is responsible to filter and relay packets Creates listening sockets for services Filters protocols before relaying

reverse http proxy

reverse http proxy table <web_hosts> { 10.0.0.1 } interval 10 timeout 200 prefork 5 log updates relay httpproxy { listen on 192.168.0.1 port 80 } forward to <web_hosts> port 80 check http "/" code 200

reverse http proxy A script can be used to check the web server status table <web_hosts> { 10.0.0.1 } relay httpproxy { listen on 192.168.0.1 port 80 } forward to <web_hosts> port 80 \ check script "/scripts/chkweb.pl"

my $remote = $ARGV[0]; my $proto = getprotobyname( tcp ); socket(socket_handle, PF_INET, SOCK_STREAM, $proto); my $hport = 80; # Http port my $sin = sockaddr_in($hport,inet_aton("$remote")); if (connect(socket_handle,$sin)) { socket(socket_handle, PF_INET, SOCK_STREAM, $proto); my $mport = 11211; # Memcached port $sin = sockaddr_in($mport,inet_aton("$remote")); if (connect(socket_handle,$sin)) { exit 1; } else { exit 0; } relayd(8) check scripts A script can be used to check the web server status... or everything else #!/usr/bin/perl -w use Socket;

http filters Relayd in reverse proxy configuration can filter http requests Change or append http headers Filter http requests by checking http headers Filter http requests by checking url

http filters http protocol "httpfilter" { # Return HTML error pages return error # allow logging of remote client ips to internal web servers header append "$REMOTE_ADDR" to "X-Forwarded-For" # URL filtering request path filter "articleid=*select*" \ from "/module/article/article/article.asp" } # close connections upon receipt header change "Connection" to "close"

http filters

ssl accelerated reverse http proxy

ssl accelerated reverse http proxy table <web_hosts> { 10.0.0.1 } http protocol "httpfilter" { } # close connections upon receipt header change "Connection" to "close" # SSL accelerator ciphers ssl { sslv3, tlsv1, ciphers "HIGH:!ADH", no sslv2 } relay httpproxy { listen on 192.168.0.1 port 443 ssl protocol "httpfilter" forward to <web_hosts> port 80 check http "/" code 200 }

ssl accelerated reverse http proxy Rsa certificate generation openssl genrsa -out /etc/ssl/private/192.168.0.1:443.key 1024 openssl req -new -key /etc/ssl/private/192.168.0.1:443.key \ -out /etc/ssl/private/192.168.0.1:443.csr openssl x509 -req -days 365 \ -in /etc/ssl/private/192.168.0.1:443.csr \ -signkey /etc/ssl/private/192.168.0.1:443.key \ -out /etc/ssl/192.168.0.1:443.crt With the files 192.168.0.1:443.crt and 192.168.0.1:443.key in the right place relayd will do his job

transparent http proxy

transparent http proxy, relayd setup http protocol "httpfilter" { # Return HTML error pages return error header change "Connection" to "close" } # Block requests to unwanted hosts request header filter "*youtube.com*" from "Host" request header filter "*facebook.com*" from "Host" relay httpproxy { listen on 127.0.0.1 port 8080 protocol "httpfilter" forward to destination }

application redirector

application redirector, relayd setup table <srv> { 192.168.0.1, 192.168.0.2 } redirect mysql { listen on 192.168.3.1 port 3306 tag RELAYD sticky-address forward to <srv> port 3306 mode roundrobin check tcp }

load balancer

load balancer dns protocol "dnsfilter" { tcp { nodelay, sack, socket buffer 1024, backlog 1000 } } relay dnsproxy { listen on 127.0.0.1 port 8053 protocol "dnsfilter" } forward to <dns_servers> port 53 \ mode loadbalance check tcp

relayctl(8) relayctl is the software used to control relayd It can change many configurations at runtime It can be used to show many informations about our current relayd(8) setup

relayctl(8) Some info for our relay setup $ sudo relayctl show sessions session 0:1 192.168.107.205:44159 -> :80 RUNNING age 00:00:01, idle 00:00:01, relay 1, pid 5613 $ sudo relayctl show hosts Id Type Name Avlblty Status 1 table web_hosts:80 active (3 hosts) 1 host 10.0.0.1 100.00% up total: 12/12 checks 2 host 10.10.10.22 100.00% up total: 12/12 checks 3 host 10.10.10.33 100.00% up total: 12/12 checks

relayctl(8) Some info for our redirect setup $ sudo relayctl show summary Id Type Name Avlblty Status 1 redirect mysql active 1 table srv:3306 active (1 hosts) 1 host 192.168.1.3 100.00% up 2 host 192.168.1.4 0.00% down

relayctl(8) Pf interaction $ sudo pfctl -a relayd/mysql -s rules pass in quick on rdomain 0 inet proto tcp from any \ to 192.168.1.5 port = 3306 flags S/SA \ keep state (tcp.established 600) \ tag RELAYD rdr-to <mysql> port 3306 \ round-robin sticky-address

advanced monitoring Both Munin and Nagios have plugins to check relayd health status

questions?