| 1 |
== Enabling PROXY Protocol |
| 2 |
|
| 3 |
Now that we have a working configuration which used RadSec and HAproxy |
| 4 |
or Traefik, we are finally ready to enable PROXY Protocol. |
| 5 |
|
| 6 |
Configure FreeRADIUS on the `radsecsvr` host to expect the PROXY |
| 7 |
Protocol for RadSec connections. This is done by editing the `listen |
| 8 |
{}` section of the `tls` virtual server to include a reference to the |
| 9 |
proxy protocol: |
| 10 |
|
| 11 |
.Enabling PROXY Protocol in a FreeRADIUS virtual server |
| 12 |
======================================================= |
| 13 |
|
| 14 |
listen { |
| 15 |
... |
| 16 |
proxy_protocol = true |
| 17 |
... |
| 18 |
} |
| 19 |
|
| 20 |
======================================================= |
| 21 |
|
| 22 |
Now restart the debugging session: |
| 23 |
[source,shell] |
| 24 |
---- |
| 25 |
radiusd -fxxl /dev/stdout |
| 26 |
---- |
| 27 |
|
| 28 |
|
| 29 |
For HAproxy, you should enable the PROXY Protocol on connections to |
| 30 |
the RadSec backend, by editing the `backend` definition to add a |
| 31 |
`send-proxy` argument: |
| 32 |
|
| 33 |
.Example HAproxy backend configuration with PROXY Protocol |
| 34 |
========================================================== |
| 35 |
|
| 36 |
backend radsec_be |
| 37 |
mode tcp |
| 38 |
balance roundrobin |
| 39 |
server radsecsvr 172.23.0.3:2083 send-proxy |
| 40 |
|
| 41 |
========================================================== |
| 42 |
|
| 43 |
Note the `send-proxy` argument in the `server` definition. |
| 44 |
|
| 45 |
Now reload the HAproxy service: |
| 46 |
|
| 47 |
[source,shell] |
| 48 |
---- |
| 49 |
service haproxy reload |
| 50 |
---- |
| 51 |
|
| 52 |
|
| 53 |
For Traefik, enable the PROXY Protocol on connections to the RadSec |
| 54 |
backend by editing the `radsec-service` definition to add a reference |
| 55 |
to the proxy protocol" |
| 56 |
|
| 57 |
.Example Traefik service configuration with PROXY Protocol |
| 58 |
========================================================== |
| 59 |
|
| 60 |
radsec-service: |
| 61 |
loadBalancer: |
| 62 |
servers: |
| 63 |
- address: "172.23.0.3:2083" |
| 64 |
proxyProtocol: |
| 65 |
version: 1 |
| 66 |
|
| 67 |
========================================================== |
| 68 |
|
| 69 |
Note the `proxyProtocol` and `version: 1` directives. |
| 70 |
|
| 71 |
Traefik should automatically detect the updates and reconfigure the |
| 72 |
service. |
| 73 |
|
| 74 |
|
| 75 |
=== Testing RadSec connectivity via a proxy using PROXY Protocol |
| 76 |
|
| 77 |
Finally, with your test client configured to use the proxy, perform a |
| 78 |
test authentication: |
| 79 |
|
| 80 |
[source,shell] |
| 81 |
---- |
| 82 |
echo "User-Name = bob" | radclient 127.0.0.1 auth testing123 |
| 83 |
---- |
| 84 |
|
| 85 |
You should expect to see the familiar output: |
| 86 |
|
| 87 |
.Example output from radclient |
| 88 |
============================== |
| 89 |
|
| 90 |
Sent Access-Request Id 252 from 0.0.0.0:50118 to 127.0.0.1:1812 length 27 |
| 91 |
Received Access-Accept Id 252 from 127.0.0.1:1812 to 127.0.0.1:50118 length 39 |
| 92 |
|
| 93 |
============================== |
| 94 |
|
| 95 |
Now examine the FreeRADIUS debug output on the RadSec server: |
| 96 |
|
| 97 |
.Expected output from `radiusd -X` with PROXY Protocol |
| 98 |
====================================================== |
| 99 |
|
| 100 |
... |
| 101 |
(0) (TLS) Received PROXY protocol connection from client \ |
| 102 |
172.23.0.2:55343 -> 172.23.0.4:2083, via proxy 172.23.0.4:40268 -> 0.0.0.0:2083 |
| 103 |
... |
| 104 |
(0) Received Access-Request Id 227 from 172.23.0.2:55343 to 172.23.0.4:2083 length 49 |
| 105 |
(0) Sent Access-Accept Id 227 from 172.23.0.4:2083 to 172.23.0.2:55343 length 0 |
| 106 |
... |
| 107 |
|
| 108 |
====================================================== |
| 109 |
|
| 110 |
The output indicates that FreeRADIUS is receiving the originating |
| 111 |
connection information from the PROXY Protocol. FreeRADIUS then |
| 112 |
handles the RadSec requests as though they have been received directly |
| 113 |
from the originating client. |
| 114 |
|