| 1 |
= Proxying RadSec and enabling PROXY Protocol |
| 2 |
|
| 3 |
This guide shows how to set up FreeRADIUS to serve RadSec connections, fronted |
| 4 |
by either HAproxy or Traefik as Layer 4 proxies that pass on the original |
| 5 |
client connection information using PROXY Protocol. |
| 6 |
|
| 7 |
It is not a comprehensive guide to using RadSec with FreeRADIUS. It presents a |
| 8 |
basic configuration that uses an example CA and does not validate certificate |
| 9 |
attributes or perform revokation status. |
| 10 |
|
| 11 |
|
| 12 |
== Introduction |
| 13 |
|
| 14 |
FreeRADIUS supports receiving RADIUS requests over TLS-enabled TCP connections |
| 15 |
and supports proxying of requests over TCP connections to another TLS-enabled |
| 16 |
homeserver. The protocol for RADIUS over TLS is called "RadSec" and is defined |
| 17 |
in RFC 6614. |
| 18 |
|
| 19 |
FreeRADIUS is a capable and performant application-aware ("Layer 7") proxy / |
| 20 |
load-balancer for RadSec and other forms of RADIUS traffic. |
| 21 |
|
| 22 |
|
| 23 |
=== Layer 4 proxying |
| 24 |
|
| 25 |
Rather than use an application-aware proxy it is sometimes better to reduce the |
| 26 |
performance impact incurred by re-encoding an application protocol by using a |
| 27 |
"Layer 4" proxy that operates at the level of individual connections without |
| 28 |
regard for the application protocol. Such a proxy is more of a "bump in the |
| 29 |
wire" than a request buffer and minimises the latency incurred due to proxying. |
| 30 |
|
| 31 |
It is common to see software such as HAproxy and Traefik used in Layer 4 mode |
| 32 |
in place of FreeRADIUS for purposes such as connection load balancing. In |
| 33 |
addition to improved performance, these tools have the benefit that they |
| 34 |
typically support dynamic service discovery and "hitless" reloads to |
| 35 |
automatically adapt their connection routing based on changes to backend |
| 36 |
services such as the introduction of new nodes with even a momentary loss of |
| 37 |
service. |
| 38 |
|
| 39 |
|
| 40 |
=== Loss of connection information |
| 41 |
|
| 42 |
When TCP connections are relayed through Layer 4 proxies the information |
| 43 |
about the originating source of the connection is no longer known to the |
| 44 |
backend service, unless it is otherwise made available. Identifying the |
| 45 |
originator of connections is often necessary for security purposes and for |
| 46 |
request processing. |
| 47 |
|
| 48 |
Whilst many application protcols support headers that allow proxies to preserve |
| 49 |
connection information these are not helpful in the context of Layer 4 |
| 50 |
proxying: The process of populating headers requires knowledge of the |
| 51 |
application protocol to re-encode requests as they are transmitted between the |
| 52 |
frontend and backend connections. |
| 53 |
|
| 54 |
|
| 55 |
=== PROXY Protocol |
| 56 |
|
| 57 |
PROXY Protocol overcomes this limitation by allowing the original connection |
| 58 |
information to be provided to the backend at the start of the TCP connection. |
| 59 |
After this initial data is encoded the remainder of the conversation then |
| 60 |
proceeds as normal. However now that the connection information is known to the |
| 61 |
backend server it is able to process requests made on the connection as though |
| 62 |
the connection were being made directly by the client and not via the proxy. |
| 63 |
|
| 64 |
PROXY Protocol is specified in this document: |
| 65 |
http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt |
| 66 |
|
| 67 |
|
| 68 |
== Requirements |
| 69 |
|
| 70 |
PROXY Protocol Version 1 is supported by FreeRADIUS v3.0.24 and later versions. |
| 71 |
|
| 72 |
You will require the following set of VMs or containers, each with their own |
| 73 |
IP address: |
| 74 |
|
| 75 |
[cols="1,1,1"] |
| 76 |
|=== |
| 77 |
|Hostname|IP address|Purpose |
| 78 |
|
| 79 |
|radseccli |
| 80 |
|172.23.0.2 |
| 81 |
|FreeRADIUS configured to provide a RadSec test client |
| 82 |
|
| 83 |
|radsecsvr |
| 84 |
|172.23.0.3 |
| 85 |
|FreeRADIUS configured as a RadSec server |
| 86 |
|
| 87 |
|haproxy |
| 88 |
|172.23.0.4 |
| 89 |
|HAproxy in Layer 4 mode to the FreeRADIUS RadSec backend |
| 90 |
|=== |
| 91 |
|
| 92 |
Optionally you may want to configure a host to run Traefik within a Docker |
| 93 |
container using host mode networking, perhaps configured by Docker Compose, |
| 94 |
however the installation is beyond the scope of this guide: |
| 95 |
|
| 96 |
[cols="1,1,1"] |
| 97 |
|=== |
| 98 |
|traefik |
| 99 |
|172.23.0.5 |
| 100 |
|Traefik configured as a TCP router with TLS passthrough to the FreeRADIUS RadSec backend |
| 101 |
|=== |
| 102 |
|
| 103 |
The hostnames and IP addresses provided above are for examples purposes and are |
| 104 |
used throughout the remainder of this guide. This guide provides commands and |
| 105 |
output for CentOS. Other distributions will have minor differences, including |
| 106 |
the location of the FreeRADIUS configuration (the "raddb"). |
| 107 |
|
| 108 |
[NOTE] |
| 109 |
==== |
| 110 |
You can choose to use your own hostname, IP addresses and OS distribution. You |
| 111 |
could also use official Docker images provided by the respecitive projects, |
| 112 |
however these prescribe methods for configuring and managing the services |
| 113 |
that are not typical for a normal package installation which would provide a |
| 114 |
distraction if used for by guide. |
| 115 |
==== |
| 116 |
|
| 117 |
|
| 118 |
== Sections in this guide |
| 119 |
|
| 120 |
This guide is organised into four parts that should be read in order: |
| 121 |
|
| 122 |
1. xref:protocols/proxy/enable_radsec.adoc[Enabling RadSec] |
| 123 |
2. xref:protocols/proxy/radsec_client.adoc[Configuring a test RadSec client] |
| 124 |
3. xref:protocols/proxy/radsec_with_haproxy.adoc[Proxying RadSec with HAproxy] |
| 125 |
4. xref:protocols/proxy/radsec_with_traefik.adoc[Proxying RadSec with Traefik] |
| 126 |
5. xref:protocols/proxy/enable_proxy_protocol.adoc[Enabling PROXY Protocol for RadSec] |