Merge pull request #1991 from spaetow/v3.0.x
[freeradius.git] / raddb / sites-available / inner-tunnel
index bad8cc4..70b1d8d 100644 (file)
 
 server inner-tunnel {
 
+#
+#  This next section is here to allow testing of the "inner-tunnel"
+#  authentication methods, independently from the "default" server.
+#  It is listening on "localhost", so that it can only be used from
+#  the same machine.
+#
+#      $ radtest USER PASSWORD 127.0.0.1:18120 0 testing123
+#
+#  If it works, you have configured the inner tunnel correctly.  To check
+#  if PEAP will work, use:
+#
+#      $ radtest -t mschap USER PASSWORD 127.0.0.1:18120 0 testing123
+#
+#  If that works, PEAP should work.  If that command doesn't work, then
+#
+#      FIX THE INNER TUNNEL CONFIGURATION SO THAT IT WORKS.
+#
+#  Do NOT do any PEAP tests.  It won't help.  Instead, concentrate
+#  on fixing the inner tunnel configuration.  DO NOTHING ELSE.
+#
+listen {
+       ipaddr = 127.0.0.1
+       port = 18120
+       type = auth
+}
+
+
 #  Authorization. First preprocess (hints and huntgroups files),
 #  then realms, and finally look in the "users" file.
 #
 #  The order of the realm modules will determine the order that
 #  we try to find a matching realm.
 #
-#  Make *sure* that 'preprocess' comes before any realm if you 
+#  Make *sure* that 'preprocess' comes before any realm if you
 #  need to setup hints for the remote radius server
 authorize {
        #
+       #  Take a User-Name, and perform some checks on it, for spaces and other
+       #  invalid characters.  If the User-Name appears invalid, reject the
+       #  request.
+       #
+       #  See policy.d/filter for the definition of the filter_username policy.
+       #
+       filter_username
+
+       #
+       #  Do checks on outer / inner User-Name, so that users
+       #  can't spoof us by using incompatible identities
+       #
+#      filter_inner_identity
+
+       #
        #  The chap module will set 'Auth-Type := CHAP' if we are
        #  handling a CHAP request and Auth-Type has not already been set
        chap
@@ -38,7 +80,7 @@ authorize {
        #  to read /etc/passwd or /etc/shadow directly, see the
        #  passwd module, above.
        #
-       unix
+#      unix
 
        #
        #  Look for IPASS style 'realm/', and if not found, look for
@@ -52,10 +94,32 @@ authorize {
        #  Otherwise, when the first style of realm doesn't match,
        #  the other styles won't be checked.
        #
+       #  Note that proxying the inner tunnel authentication means
+       #  that the user MAY use one identity in the outer session
+       #  (e.g. "anonymous", and a different one here
+       #  (e.g. "user@example.com").  The inner session will then be
+       #  proxied elsewhere for authentication.  If you are not
+       #  careful, this means that the user can cause you to forward
+       #  the authentication to another RADIUS server, and have the
+       #  accounting logs *not* sent to the other server.  This makes
+       #  it difficult to bill people for their network activity.
+       #
        suffix
 #      ntdomain
 
        #
+       #  The "suffix" module takes care of stripping the domain
+       #  (e.g. "@example.com") from the User-Name attribute, and the
+       #  next few lines ensure that the request is not proxied.
+       #
+       #  If you want the inner tunnel request to be proxied, delete
+       #  the next few lines.
+       #
+       update control {
+               &Proxy-To-Realm := LOCAL
+       }
+
+       #
        #  This module takes care of EAP-MSCHAPv2 authentication.
        #
        #  It also sets the EAP-Type attribute in the request
@@ -80,27 +144,22 @@ authorize {
        #  is meant to mirror the "users" file.
        #
        #  See "Authorization Queries" in sql.conf
-#      sql
+       -sql
 
        #
        #  If you are using /etc/smbpasswd, and are also doing
        #  mschap authentication, the un-comment this line, and
-       #  configure the 'etc_smbpasswd' module, above.
-#      etc_smbpasswd
+       #  enable the "smbpasswd" module.
+#      smbpasswd
 
        #
-       #  The ldap module will set Auth-Type to LDAP if it has not
-       #  already been set
-#      ldap
+       #  The ldap module reads passwords from the LDAP database.
+       -ldap
 
        #
        #  Enforce daily limits on time spent logged in.
 #      daily
 
-       #
-       # Use the checkval module
-#      checkval
-
        expiration
        logintime
 
@@ -126,7 +185,7 @@ authorize {
 #  Note that it does NOT mean 'try each module in order'.  It means
 #  that a module from the 'authorize' section adds a configuration
 #  attribute 'Auth-Type := FOO'.  That authentication type is then
-#  used to pick the apropriate module from the list below.
+#  used to pick the appropriate module from the list below.
 #
 
 #  In general, you SHOULD NOT set the Auth-Type attribute.  The server
@@ -163,22 +222,25 @@ authenticate {
        }
 
        #
-       #  Pluggable Authentication Modules.
-#      pam
+       #  For old names, too.
+       #
+       mschap
 
        #
-       #  See 'man getpwent' for information on how the 'unix'
-       #  module checks the users password.  Note that packets
-       #  containing CHAP-Password attributes CANNOT be authenticated
-       #  against /etc/passwd!  See the FAQ for details.
-       #  
-       unix
+       #  Pluggable Authentication Modules.
+#      pam
 
        # Uncomment it if you want to use ldap for authentication
        #
        # Note that this means "check plain-text password against
        # the ldap database", which means that EAP won't work,
        # as it does not supply a plain-text password.
+       #
+       #  We do NOT recommend using this.  LDAP servers are databases.
+       #  They are NOT authentication servers.  FreeRADIUS is an
+       #  authentication server, and knows what to do with authentication.
+       #  LDAP servers do not.
+       #
 #      Auth-Type LDAP {
 #              ldap
 #      }
@@ -196,7 +258,7 @@ authenticate {
 ######################################################################
 
 
-#  Session database, used for checking Simultaneous-Use. Either the radutmp 
+#  Session database, used for checking Simultaneous-Use. Either the radutmp
 #  or rlm_sql module can handle this.
 #  The rlm_sql module is *much* faster
 session {
@@ -211,28 +273,33 @@ session {
 #  Post-Authentication
 #  Once we KNOW that the user has been authenticated, there are
 #  additional steps we can take.
+#
+#  Note that the last packet of the inner-tunnel authentication
+#  MAY NOT BE the last packet of the outer session.  So updating
+#  the outer reply MIGHT work, and sometimes MIGHT NOT.  The
+#  exact functionality depends on both the inner and outer
+#  authentication methods.
+#
+#  If you need to send a reply attribute in the outer session,
+#  the ONLY safe way is to set "use_tunneled_reply = yes", and
+#  then update the inner-tunnel reply.
 post-auth {
-       # Note that we do NOT assign IP addresses here.
-       # If you try to assign IP addresses for EAP authentication types,
-       # it WILL NOT WORK.  You MUST use DHCP.
+       #  If you want privacy to remain, see the
+       #  Chargeable-User-Identity attribute from RFC 4372.
+       #  If you want to use it just uncomment the line below.
+#       cui-inner
 
        #
        #  If you want to have a log of authentication replies,
-       #  un-comment the following line, and the 'detail reply_log'
-       #  section, above.
+       #  un-comment the following line, and enable the
+       #  'detail reply_log' module.
 #      reply_log
 
        #
        #  After authenticating the user, do another SQL query.
        #
        #  See "Authentication Logging Queries" in sql.conf
-#      sql
-
-       #
-       #  Instead of sending the query to the SQL server,
-       #  write it into a log file.
-       #
-#      sql_log
+       -sql
 
        #
        #  Un-comment the following if you have set
@@ -241,50 +308,72 @@ post-auth {
        #
 #      ldap
 
+
+       #
+       #  Un-comment the following if you want to generate Moonshot (ABFAB) TargetedIds
+       #
+       #  IMPORTANT: This requires the UUID package to be installed, and a targeted_id_salt
+       #             to be configured.
+       #
+       #  This functionality also supports SQL backing. To use this functionality, enable
+       #  and configure the moonshot-targeted-ids SQL module in the mods-enabled directory.
+       #  Then remove the comments from the appropriate lines in each of the below
+       #  policies in the policy.d/moonshot-targeted-ids file.
+       #
+#      moonshot_host_tid
+#      moonshot_realm_tid
+#      moonshot_coi_tid
+
+       #
+       #  Instead of "use_tunneled_reply", change this "if (0)" to an
+       #  "if (1)".
+       #
+       if (0) {
+               #
+               #  These attributes are for the inner-tunnel only,
+               #  and MUST NOT be copied to the outer reply.
+               #
+               update reply {
+                       User-Name !* ANY
+                       Message-Authenticator !* ANY
+                       EAP-Message !* ANY
+                       Proxy-State !* ANY
+                       MS-MPPE-Encryption-Types !* ANY
+                       MS-MPPE-Encryption-Policy !* ANY
+                       MS-MPPE-Send-Key !* ANY
+                       MS-MPPE-Recv-Key !* ANY
+               }
+
+               #
+               #  Copy the inner reply attributes to the outer
+               #  session-state list.  The post-auth policy will take
+               #  care of copying the outer session-state list to the
+               #  outer reply.
+               #
+               update {
+                       &outer.session-state: += &reply:
+               }
+       }
+
        #
        #  Access-Reject packets are sent through the REJECT sub-section of the
        #  post-auth section.
        #
-       #  Add the ldap module name (or instance) if you have set 
+       #  Add the ldap module name (or instance) if you have set
        #  'edir_account_policy_check = yes' in the ldap module configuration
        #
        Post-Auth-Type REJECT {
+               # log failed authentications in SQL, too.
+               -sql
                attr_filter.access_reject
-       }
-
-       #
-       #  The example policy below updates the outer tunnel reply
-       #  (usually Access-Accept) with the User-Name from the inner
-       #  tunnel User-Name.  Since this section is processed in the
-       #  context of the inner tunnel, "request" here means "inner
-       #  tunnel request", and "outer.reply" means "outer tunnel
-       #  reply attributes".
-       #
-       #  This example is most useful when the outer session contains
-       #  a User-Name of "anonymous@....", or a MAC address.  If it
-       #  is enabled, the NAS SHOULD use the inner tunnel User-Name
-       #  in subsequent accounting packets.  This makes it easier to
-       #  track user sessions, as they will all be based on the real
-       #  name, and not on "anonymous".
-       #
-       #  The problem with doing this is that it ALSO exposes the
-       #  real user name to any intermediate proxies.  People use
-       #  "anonymous" identifiers outside of the tunnel for a very
-       #  good reason: it gives them more privacy.  Setting the reply
-       #  to contain the real user name removes ALL privacy from
-       #  their session.
-       #
-       #  If you want privacy to remain, see the
-       #  Chargeable-User-Identity attribute from RFC 4372.  In order
-       #  to use that attribute, you will have to allocate a
-       #  per-session identifier for the user, and store it in a
-       #  long-term database (e.g. SQL).  You should also use that
-       #  attribute INSTEAD of the configuration below.
-       #
-       #update outer.reply {
-       #       User-Name = "%{request:User-Name}"
-       #}
 
+               #
+               #  Let the outer session know which module failed, and why.
+               #
+               update outer.session-state {
+                       &Module-Failure-Message := &request:Module-Failure-Message
+               }
+       }
 }
 
 #
@@ -296,8 +385,6 @@ post-auth {
 #  Only a few modules currently have this method.
 #
 pre-proxy {
-#      attr_rewrite
-
        #  Uncomment the following line if you want to change attributes
        #  as defined in the preproxy_users file.
 #      files
@@ -325,8 +412,6 @@ post-proxy {
        #  section, above.
 #      post_proxy_log
 
-#      attr_rewrite
-
        #  Uncomment the following line if you want to filter replies from
        #  remote proxies based on the rules defined in the 'attrs' file.
 #      attr_filter.post-proxy
@@ -343,28 +428,6 @@ post-proxy {
        #  reject the EAP request.
        #
        eap
-
-       #
-       #  If the server tries to proxy a request and fails, then the
-       #  request is processed through the modules in this section.
-       #
-       #  The main use of this section is to permit robust proxying
-       #  of accounting packets.  The server can be configured to
-       #  proxy accounting packets as part of normal processing.
-       #  Then, if the home server goes down, accounting packets can
-       #  be logged to a local "detail" file, for processing with
-       #  radrelay.  When the home server comes back up, radrelay
-       #  will read the detail file, and send the packets to the
-       #  home server.
-       #
-       #  With this configuration, the server always responds to
-       #  Accounting-Requests from the NAS, but only writes
-       #  accounting packets to disk if the home server is down.
-       #
-#      Post-Proxy-Type Fail {
-#                      detail
-#      }
-
 }
 
 } # inner-tunnel server block