Sample TLS configuration for RadSec
authorAlan T. DeKok <aland@freeradius.org>
Sat, 2 Apr 2011 08:15:08 +0000 (10:15 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 10 May 2011 11:33:54 +0000 (13:33 +0200)
This documents RADIUS over TLS over TCP.

raddb/Makefile
raddb/sites-available/tls [new file with mode: 0644]

index c5aff19..b1463f6 100644 (file)
@@ -28,6 +28,11 @@ all:
        @if [ ! -f sites-enabled/inner-tunnel ]; then \
                cd sites-enabled && ln -s ../sites-available/inner-tunnel; \
        fi
+ifneq "${OPENSSL_INCLUDE}" ""
+       @if [ ! -f sites-enabled/tls ]; then \
+               cd sites-enabled && ln -s ../sites-available/tls; \
+       fi
+endif
 
 install:
        $(INSTALL) -d -m 750    $(R)$(raddbdir)
@@ -85,9 +90,16 @@ install:
                cd $(R)$(raddbdir)/sites-enabled/; \
                ln -s ../sites-available/control-socket; \
        fi
+ifneq "${OPENSSL_INCLUDE}" ""
+       if [ ! -f $(R)$(raddbdir)/sites-enabled/control-socket ]; then \
+               cd $(R)$(raddbdir)/sites-enabled/; \
+               ln -s ../sites-available/control-socket; \
+       fi
+endif
 
 clean:
-       rm -rf sites-enabled/inner-tunnel sites-enabled/default
+       rm -rf sites-enabled/inner-tunnel sites-enabled/default \
+               sites-enabled/tls
 
 triggers:
        @grep exec_trigger `find ../src -name "*.c" -print` | grep '"' | sed -e 's/.*,//' -e 's/ *"//' -e 's/");.*//'
diff --git a/raddb/sites-available/tls b/raddb/sites-available/tls
new file mode 100644 (file)
index 0000000..7327500
--- /dev/null
@@ -0,0 +1,403 @@
+######################################################################
+#
+#  Initial implementation of RADIUS over TLS (radsec)
+#
+######################################################################
+
+listen {
+       ipaddr = *
+       port = 2083
+       type = auth
+
+       # For now, only TCP transport is allowed.
+       proto = tcp
+
+       clients = radsec
+
+       #  This is *exactly* the same configuration as used by the EAP-TLS
+       #  module.  It's OK for testing, but for production use it's a good
+       #  idea to use different server certificates for EAP and for RADIUS
+       #  transport.
+       tls {
+               #
+               #  These is used to simplify later configurations.
+               #
+               certdir = ${confdir}/certs
+               cadir = ${confdir}/certs
+
+               private_key_password = whatever
+               private_key_file = ${certdir}/server.pem
+
+               #  If Private key & Certificate are located in
+               #  the same file, then private_key_file &
+               #  certificate_file must contain the same file
+               #  name.
+               #
+               #  If CA_file (below) is not used, then the
+               #  certificate_file below MUST include not
+               #  only the server certificate, but ALSO all
+               #  of the CA certificates used to sign the
+               #  server certificate.
+               certificate_file = ${certdir}/server.pem
+
+               #  Trusted Root CA list
+               #
+               #  ALL of the CA's in this list will be trusted
+               #  to issue client certificates for authentication.
+               #
+               #  In general, you should use self-signed
+               #  certificates for 802.1x (EAP) authentication.
+               #  In that case, this CA file should contain
+               #  *one* CA certificate.
+               #
+               #  This parameter is used only for EAP-TLS,
+               #  when you issue client certificates.  If you do
+               #  not use client certificates, and you do not want
+               #  to permit EAP-TLS authentication, then delete
+               #  this configuration item.
+               CA_file = ${cadir}/ca.pem
+
+               #
+               #  For DH cipher suites to work, you have to
+               #  run OpenSSL to create the DH file first:
+               #
+               #       openssl dhparam -out certs/dh 1024
+               #
+               dh_file = ${certdir}/dh
+               random_file = ${certdir}/random
+
+               #
+               #  This can never exceed the size of a RADIUS
+               #  packet (4096 bytes), and is preferably half
+               #  that, to accomodate other attributes in
+               #  RADIUS packet.  On most APs the MAX packet
+               #  length is configured between 1500 - 1600
+               #  In these cases, fragment size should be
+               #  1024 or less.
+               #
+       #       fragment_size = 1024
+
+               #  include_length is a flag which is
+               #  by default set to yes If set to
+               #  yes, Total Length of the message is
+               #  included in EVERY packet we send.
+               #  If set to no, Total Length of the
+               #  message is included ONLY in the
+               #  First packet of a fragment series.
+               #
+       #       include_length = yes
+
+               #  Check the Certificate Revocation List
+               #
+               #  1) Copy CA certificates and CRLs to same directory.
+               #  2) Execute 'c_rehash <CA certs&CRLs Directory>'.
+               #    'c_rehash' is OpenSSL's command.
+               #  3) uncomment the line below.
+               #  5) Restart radiusd
+       #       check_crl = yes
+               CA_path = ${cadir}
+
+              #
+              #  If check_cert_issuer is set, the value will
+              #  be checked against the DN of the issuer in
+              #  the client certificate.  If the values do not
+              #  match, the cerficate verification will fail,
+              #  rejecting the user.
+              #
+              #  In 2.1.10 and later, this check can be done
+              #  more generally by checking the value of the
+              #  TLS-Client-Cert-Issuer attribute.  This check
+              #  can be done via any mechanism you choose.
+              #
+       #       check_cert_issuer = "/C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd"
+
+              #
+              #  If check_cert_cn is set, the value will
+              #  be xlat'ed and checked against the CN
+              #  in the client certificate.  If the values
+              #  do not match, the certificate verification
+              #  will fail rejecting the user.
+              #
+              #  This check is done only if the previous
+              #  "check_cert_issuer" is not set, or if
+              #  the check succeeds.
+              #
+              #  In 2.1.10 and later, this check can be done
+              #  more generally by checking the value of the
+              #  TLS-Client-Cert-CN attribute.  This check
+              #  can be done via any mechanism you choose.
+              #
+       #       check_cert_cn = %{User-Name}
+       #
+               # Set this option to specify the allowed
+               # TLS cipher suites.  The format is listed
+               # in "man 1 ciphers".
+               cipher_list = "DEFAULT"
+
+               #
+
+               #  This configuration entry should be deleted
+               #  once the server is running in a normal
+               #  configuration.  It is here ONLY to make
+               #  initial deployments easier.
+               #
+               #
+               #  This is enabled in eap.conf, so we don't need it here.
+               #
+#              make_cert_command = "${certdir}/bootstrap"
+
+               #
+               #  Session resumption / fast reauthentication
+               #  cache.
+               #
+               #  The cache contains the following information:
+               #
+               #  session Id - unique identifier, managed by SSL
+               #  User-Name  - from the Access-Accept
+               #  Stripped-User-Name - from the Access-Request
+               #  Cached-Session-Policy - from the Access-Accept
+               #
+               #  The "Cached-Session-Policy" is the name of a
+               #  policy which should be applied to the cached
+               #  session.  This policy can be used to assign
+               #  VLANs, IP addresses, etc.  It serves as a useful
+               #  way to re-apply the policy from the original
+               #  Access-Accept to the subsequent Access-Accept
+               #  for the cached session.
+               #
+               #  On session resumption, these attributes are
+               #  copied from the cache, and placed into the
+               #  reply list.
+               #
+               #  You probably also want "use_tunneled_reply = yes"
+               #  when using fast session resumption.
+               #
+               cache {
+                     #
+                     #  Enable it.  The default is "no".
+                     #  Deleting the entire "cache" subsection
+                     #  Also disables caching.
+                     #
+                     #  You can disallow resumption for a
+                     #  particular user by adding the following
+                     #  attribute to the control item list:
+                     #
+                     #         Allow-Session-Resumption = No
+                     #
+                     #  If "enable = no" below, you CANNOT
+                     #  enable resumption for just one user
+                     #  by setting the above attribute to "yes".
+                     #
+                     enable = no
+
+                     #
+                     #  Lifetime of the cached entries, in hours.
+                     #  The sessions will be deleted after this
+                     #  time.
+                     #
+                     lifetime = 24 # hours
+
+                     #
+                     #  The maximum number of entries in the
+                     #  cache.  Set to "0" for "infinite".
+                     #
+                     #  This could be set to the number of users
+                     #  who are logged in... which can be a LOT.
+                     #
+                     max_entries = 255
+               }
+
+               #
+               #  Require a client certificate.
+               #
+               require_client_cert = yes
+
+               #
+               #  As of version 2.1.10, client certificates can be
+               #  validated via an external command.  This allows
+               #  dynamic CRLs or OCSP to be used.
+               #
+               #  This configuration is commented out in the
+               #  default configuration.  Uncomment it, and configure
+               #  the correct paths below to enable it.
+               #
+               verify {
+                       #  A temporary directory where the client
+                       #  certificates are stored.  This directory
+                       #  MUST be owned by the UID of the server,
+                       #  and MUST not be accessible by any other
+                       #  users.  When the server starts, it will do
+                       #  "chmod go-rwx" on the directory, for
+                       #  security reasons.  The directory MUST
+                       #  exist when the server starts.
+                       #
+                       #  You should also delete all of the files
+                       #  in the directory when the server starts.
+       #               tmpdir = /tmp/radiusd
+
+                       #  The command used to verify the client cert.
+                       #  We recommend using the OpenSSL command-line
+                       #  tool.
+                       #
+                       #  The ${..CA_path} text is a reference to
+                       #  the CA_path variable defined above.
+                       #
+                       #  The %{TLS-Client-Cert-Filename} is the name
+                       #  of the temporary file containing the cert
+                       #  in PEM format.  This file is automatically
+                       #  deleted by the server when the command
+                       #  returns.
+       #               client = "/path/to/openssl verify -CApath ${..CA_path} %{TLS-Client-Cert-Filename}"
+               }
+       }
+}
+
+clients radsec {
+       client 127.0.0.1 {
+               ipaddr = 127.0.0.1
+               proto = tcp
+               secret = testing123
+       }
+}
+
+listen {
+       ipaddr = 127.0.0.1
+       port = 4000
+       type = auth
+}
+
+home_server tls {
+       ipaddr = 127.0.0.1
+       port = 2083
+       type = auth
+       secret = testing123
+       proto = tcp
+       status_check = status-server
+
+       tls {
+               #
+               #  These is used to simplify later configurations.
+               #
+               certdir = ${confdir}/certs
+               cadir = ${confdir}/certs
+
+               private_key_password = whatever
+               private_key_file = ${certdir}/client.pem
+
+               #  If Private key & Certificate are located in
+               #  the same file, then private_key_file &
+               #  certificate_file must contain the same file
+               #  name.
+               #
+               #  If CA_file (below) is not used, then the
+               #  certificate_file below MUST include not
+               #  only the server certificate, but ALSO all
+               #  of the CA certificates used to sign the
+               #  server certificate.
+               certificate_file = ${certdir}/client.pem
+
+               #  Trusted Root CA list
+               #
+               #  ALL of the CA's in this list will be trusted
+               #  to issue client certificates for authentication.
+               #
+               #  In general, you should use self-signed
+               #  certificates for 802.1x (EAP) authentication.
+               #  In that case, this CA file should contain
+               #  *one* CA certificate.
+               #
+               #  This parameter is used only for EAP-TLS,
+               #  when you issue client certificates.  If you do
+               #  not use client certificates, and you do not want
+               #  to permit EAP-TLS authentication, then delete
+               #  this configuration item.
+               CA_file = ${cadir}/ca.pem
+
+               #
+               #  For DH cipher suites to work, you have to
+               #  run OpenSSL to create the DH file first:
+               #
+               #       openssl dhparam -out certs/dh 1024
+               #
+               dh_file = ${certdir}/dh
+               random_file = ${certdir}/random
+
+               #
+               #  This can never exceed the size of a RADIUS
+               #  packet (4096 bytes), and is preferably half
+               #  that, to accomodate other attributes in
+               #  RADIUS packet.  On most APs the MAX packet
+               #  length is configured between 1500 - 1600
+               #  In these cases, fragment size should be
+               #  1024 or less.
+               #
+       #       fragment_size = 1024
+
+               #  include_length is a flag which is
+               #  by default set to yes If set to
+               #  yes, Total Length of the message is
+               #  included in EVERY packet we send.
+               #  If set to no, Total Length of the
+               #  message is included ONLY in the
+               #  First packet of a fragment series.
+               #
+       #       include_length = yes
+
+               #  Check the Certificate Revocation List
+               #
+               #  1) Copy CA certificates and CRLs to same directory.
+               #  2) Execute 'c_rehash <CA certs&CRLs Directory>'.
+               #    'c_rehash' is OpenSSL's command.
+               #  3) uncomment the line below.
+               #  5) Restart radiusd
+       #       check_crl = yes
+               CA_path = ${cadir}
+
+              #
+              #  If check_cert_issuer is set, the value will
+              #  be checked against the DN of the issuer in
+              #  the client certificate.  If the values do not
+              #  match, the cerficate verification will fail,
+              #  rejecting the user.
+              #
+              #  In 2.1.10 and later, this check can be done
+              #  more generally by checking the value of the
+              #  TLS-Client-Cert-Issuer attribute.  This check
+              #  can be done via any mechanism you choose.
+              #
+       #       check_cert_issuer = "/C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd"
+
+              #
+              #  If check_cert_cn is set, the value will
+              #  be xlat'ed and checked against the CN
+              #  in the client certificate.  If the values
+              #  do not match, the certificate verification
+              #  will fail rejecting the user.
+              #
+              #  This check is done only if the previous
+              #  "check_cert_issuer" is not set, or if
+              #  the check succeeds.
+              #
+              #  In 2.1.10 and later, this check can be done
+              #  more generally by checking the value of the
+              #  TLS-Client-Cert-CN attribute.  This check
+              #  can be done via any mechanism you choose.
+              #
+       #       check_cert_cn = %{User-Name}
+       #
+               # Set this option to specify the allowed
+               # TLS cipher suites.  The format is listed
+               # in "man 1 ciphers".
+               cipher_list = "DEFAULT"
+       }
+
+}
+
+home_server_pool tls {
+                type = fail-over
+                home_server = tls
+}
+
+realm tls {
+      auth_pool = tls
+}