]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Various fixups
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 24 Sep 2019 11:00:01 +0000 (06:00 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 24 Sep 2019 11:00:38 +0000 (06:00 -0500)
36 files changed:
doc/antora/modules/tutorials/nav.adoc
doc/antora/modules/tutorials/pages/accounting.adoc
doc/antora/modules/tutorials/pages/autz-type.adoc
doc/antora/modules/tutorials/pages/dictionary.adoc
doc/antora/modules/tutorials/pages/dynamic-translation.adoc
doc/antora/modules/tutorials/pages/eap-md5.adoc
doc/antora/modules/tutorials/pages/eap-peap.adoc
doc/antora/modules/tutorials/pages/eap-tls.adoc
doc/antora/modules/tutorials/pages/eap-ttls.adoc
doc/antora/modules/tutorials/pages/matching_users.adoc
doc/antora/modules/tutorials/pages/module_fail_over.adoc
doc/antora/modules/tutorials/pages/multiple_modules.adoc
doc/antora/modules/tutorials/pages/new_client.adoc
doc/antora/modules/tutorials/pages/new_user.adoc
doc/antora/modules/tutorials/pages/prepaid.adoc
doc/antora/modules/tutorials/pages/proxy.adoc
doc/antora/modules/tutorials/pages/proxy_failover.adoc
doc/antora/modules/tutorials/pages/proxy_load_balance.adoc
doc/antora/modules/tutorials/pages/proxy_receive.adoc
doc/antora/modules/tutorials/pages/radmin.adoc
doc/antora/modules/tutorials/pages/simultaneous_use.adoc
doc/antora/modules/tutorials/pages/sql.adoc
doc/antora/modules/tutorials/pages/sql_user.adoc
doc/antora/modules/tutorials/pages/unlang_conditions.adoc [deleted file]
doc/antora/modules/tutorials/pages/unlang_policies.adoc
doc/antora/modules/tutorials/pages/unlang_return_codes.adoc [new file with mode: 0644]
doc/antora/modules/tutorials/pages/unlang_splitting_strings.adoc [new file with mode: 0644]
doc/antora/modules/tutorials/pages/unlang_update_blocks_and_conditions.adoc [new file with mode: 0644]
doc/antora/modules/tutorials/pages/variables.adoc
doc/antora/modules/tutorials/pages/virtual.adoc
doc/antora/modules/tutorials/partials/common_control_attrs_sidebar.adoc [new file with mode: 0644]
doc/antora/modules/tutorials/partials/unlang_start.adoc [new file with mode: 0644]
doc/antora/modules/unlang/nav.adoc
doc/antora/modules/unlang/pages/condition/cmp.adoc
doc/antora/modules/unlang/pages/condition/regex.adoc [moved from doc/antora/modules/unlang/pages/regex.adoc with 100% similarity]
doc/antora/modules/unlang/pages/module_builtin.adoc

index c0cf25abd83b48350b409cff4cd35eb7646bd067..a31b8c708cdc9f3fecafd522ba6d5f0f500b995d 100644 (file)
@@ -1,13 +1,21 @@
 ** Tutorials
 *** xref:new_user.adoc[New User]
+*** xref:matching_users.adoc[Matching Users]
 *** xref:new_client.adoc[New Client]
+
 *** xref:accounting.adoc[Accounting]
-*** xref:simultaneous_use.adoc[Simultaneous Use]
-*** xref:matching_users.adoc[Matching Users]
+**** xref:simultaneous_use.adoc[Simultaneous Use]
+
+*** Unlang
+**** xref:unlang_update_blocks_and_conditions.adoc[Update blocks and conditions]
+**** xref:unlang_splitting_strings.adoc[Splitting strings]
+**** xref:unlang_policies.adoc[Policies]
+
 *** xref:proxy.adoc[Proxying]
 **** xref:proxy_receive.adoc[Proxy Receive]
 **** xref:proxy_failover.adoc[Proxy Fail-Over]
 **** xref:proxy_load_balance.adoc[Proxy Load-Balance]
+
 *** xref:sql.adoc[SQL]
 **** xref:sql_user.adoc[SQL Users]
 *** xref:variables.adoc[Variables]
index 33637d58a5a3b9f78e0df72034a24d2af12e4c17..73093044c881a105e06f3e347c2b347ea301879e 100644 (file)
@@ -1,6 +1,4 @@
-[[accounting]]
-Accounting Requests
--------------------
+= Accounting Requests
 
 *Goal*: To send the server accounting requests and to have the server
 log the accounting requests.
@@ -116,9 +114,7 @@ the `radwho` command.
 The "detail" module simply logs every accounting request to a file in a simple
 textual format.
 
-[[accounting-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why do accounting messages require less configuration of the server
 than authentication methods?
index 831c76d6a1b0fc8729b06431f6ce2264eeb8a119..3c119a58969c3d00b33daa45b5a3b11650672f99 100644 (file)
@@ -1,6 +1,4 @@
-[[autz-type]]
-Using the Autz-Type attribute
------------------------------
+= Using the Autz-Type attribute
 
 *Goal:* To control which authorization modules are executed for an
 `Access-Request`
@@ -60,8 +58,7 @@ $ ls /var/log/radius/radacct/bydate/
 --------------------------------------------------
 
 [[autz-type-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 // Copyright (C) 2019 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
 // Development of this documentation was sponsored by Network RADIUS SAS.
index 56085e8f2bff6961bc4ba365f344d0d63a524d88..b40d443192a972660ae150c75f79911c7f9aa916 100644 (file)
@@ -1,6 +1,4 @@
-[[custom-dictionaries-and-attributes]]
-Custom Dictionaries and Attributes
-----------------------------------
+= Custom Dictionaries and Attributes
 
 *Goal:* To understand how the dictionaries affect the server and to create
 a new vendor-specific dictionary with a number of custom attributes; also, to test those attributes in the server.
@@ -60,8 +58,7 @@ authentication request for user "bob", and verify that the access accept
 contains the expected attributes.
 
 [[dictionary-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What happens when the same attribute has multiple names, i.e.,
 multiple names for one number?
index 7ee12c02be4e5265e0a787e012a8867318ba06ae..da5fafc55a6f147aed7aa87dafd42596dad77bdb 100644 (file)
@@ -1,6 +1,4 @@
-[[dynamic-translation]]
-Further dynamic translation
----------------------------
+= Further dynamic translation
 
 *Goal:* To use dynamic translation of strings to perform inter-module
 references.
@@ -103,9 +101,7 @@ bob Cleartext-Password := "hello"
 In this case, the user "bob" is given one minute of access time,
 multiplied by the value of the "UID" of the RADIUS server.
 
-[[further-considerations]]
-Further considerations
-~~~~~~~~~~~~~~~~~~~~~~
+== Further considerations
 
 Run-time variables allow inter-module calling. The administator may perform LDAP
 queries and SQL queries to use database information in other modules.
@@ -121,9 +117,7 @@ Another limitation is that the query string can be only approximately 250
 characters long in the current version of the server. This limitation may be
 removed in a later version.
 
-[[dynamic-translation-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  How would you perform an SQL query in a run-time variable, instead of
 executing a program?
index fc239e90071dca051daf0d7430ef451aa77922e6..fd234989ca5b0bb0a52390f6983581d49ad485ab 100644 (file)
@@ -1,6 +1,4 @@
-[[eap-md5]]
-Other protocols within RADIUS: EAP-MD5
---------------------------------------
+= Other protocols within RADIUS: EAP-MD5
 
 *Goal:* To configure the server to use the EAP-MD5 authentication
 protocol and to send and receive test packets.
@@ -49,9 +47,7 @@ schematic diagram
 
 image::eap-md5.svg[Fig. EAP-MD5]
 
-[[eap-md5-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  In which of the following sections is the `eap` module used?
 authorize, authenticate, and accounting.
index 326b16184978e03790d8a670438fc04117b75698..dae55c27bf400d443ceaea891f4a841095c786fa 100644 (file)
@@ -1,6 +1,4 @@
-[[eap-peap]]
-EAP-PEAP: Tunneled authentication
----------------------------------
+= EAP-PEAP: Tunneled authentication
 
 *Goal:* To configure the server to use the EAP-PEAP authentication
 protocol and to send and receive test packets.
@@ -54,9 +52,7 @@ contain the `MS-MPPE-Recv-Key` and `MS-MPPE-Send-Key` attributes.
 Verify that the authentication succeeded by using the `ping` command to
 see if the wireless client now has network access.
 
-[[eap-peap-further-considerations]]
-Further Considerations
-~~~~~~~~~~~~~~~~~~~~~~
+== Further Considerations
 
 Different wireless clients may implement different tunneled
 authentication protocols inside of EAP-PEAP. These clients may not be
@@ -74,9 +70,7 @@ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Tracing\RASTLS\EnableTracing
 Set the above key to value ``1''. A file `RASTLS.LOG` will be created
 and will contain the requested tracing information.
 
-[[eap-peap-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  How does EAP-PEAP compare with EAP-TTLS?
 2.  What authentication protocols may be carried inside of the TLS
index 2c2cc4010d8eeaebdd715d20b7f3db146a4d00a8..1b2518cff15c454cc3086c56956604e81a398aa3 100644 (file)
@@ -1,6 +1,4 @@
-[[eap-tls]]
-EAP-TLS: Certificate-based authentication
------------------------------------------
+= EAP-TLS: Certificate-based authentication
 
 *Goal:* To configure the server to use the EAP-TLS authentication
 protocol and to send and receive test packets.
@@ -76,9 +74,7 @@ should contain the `MS-MPPE-Recv-Key` and `MS-MPPE-Send-Key` attributes.
 Verify that the authentication succeeded by using the `ping` command to
 see if the wireless client now has network access.
 
-[[eap-tls-further-considerations]]
-Further considerations
-~~~~~~~~~~~~~~~~~~~~~~
+== Further considerations
 
 EAP-TLS is an authentication protocol and nothing more. As such, the
 wireless client will still need to obtain an IP address. This address
@@ -101,9 +97,7 @@ computer) to perform EAP-TLS may be difficult. Windows (since Windows XP)
 ships with an EAP-PEAP client, which may influence any decision about
 which wireless authentication protocol to use.
 
-[[eap-tls-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What other benefits does EAP-TLS have over EAP-MD5?
 2.  What happens to the user's password when they use EAP-TLS?
index af7890ca657c227b8b6a466502de0af2e4144b0f..0b0c7e9e5da99e26c35c3d7f47921795e495da13 100644 (file)
@@ -1,6 +1,4 @@
-[[eap-ttls]]
-EAP-TTLS: Tunneled authentication
----------------------------------
+= EAP-TTLS: Tunneled authentication
 
 *Goal:* To configure the server to use the EAP-TTLS authentication
 protocol and to send and receive test packets.
@@ -38,9 +36,7 @@ contain the `MS-MPPE-Recv-Key` and `MS-MPPE-Send-Key` attributes.
 Verify that the authentication succeeded by using the `ping` command to
 see if the wireless client now has network access.
 
-[[eap-ttls-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  How is EAP-TTLS easier to use than EAP-TLS?
 2.  What authentication protocols may be carried inside of the TLS
index d4906aea378e159afeba7cca26acb03b2f49894b..5cd1f2b005fe4569f4e16db1e5753f5179375dde 100644 (file)
@@ -1,6 +1,4 @@
-[[matching-users]]
-Matching entries in the users file
-----------------------------------
+= Matching entries in the users file
 
 *Goal:* To configure multiple entries for a user in the "users" file
 and to validate the server's configuration by sending test packets to
@@ -52,9 +50,7 @@ that will match:
 
 Save copies of the packets.
 
-[[matching-users-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What is the difference between the Framed-Route and Framed-Routing
 Attributes?
index bdb95c8ded53fd9b516d6e345d62cbebf38f17e6..5aa19320a34baf029f533e62f6cc2a34e33a2b5e 100644 (file)
@@ -1,6 +1,4 @@
-[[module-fail-over]]
-Module Fail-Over
-----------------
+= Module Fail-Over
 
 *Goal:* To configure the server to use a "backup" module if a
 "primary" module fails.
@@ -105,9 +103,7 @@ request:
 $ more /var/log/radius/radacct/detail2
 -----------------------------------------------
 
-[[module-fail-over-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Could the configuration for the "group" section containing the
 "detail1" and "detail2" modules be simplified? If so, how?
index 0d0b275efb5d020925fd1fa613052ccf8826f6b2..0df72b502575d27f8b1127b80a4a6af8463ba48d 100644 (file)
@@ -1,6 +1,4 @@
-[[multiple-modules]]
-Multiple instances of a module
-------------------------------
+= Multiple instances of a module
 
 *Goal:* To configure the server to have multiple instances of a module.
 
@@ -63,9 +61,7 @@ $ more /var/log/radius/radacct/bydate/*
 Once you have verified that the files exist and that the correct
 information is logged in them, you may stop the server.
 
-[[multiple-modules-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why is it useful to have multiple versions of a module?
 
index a0bba75c1df7b23fd96f7891404940d923cde28e..6a12fb395bcf4fe818373ba6470ac972bc03fc83 100644 (file)
@@ -1,6 +1,4 @@
-[[new-clients]]
-Adding a new client to the server
----------------------------------
+= Adding a new client to the server
 
 *Goal:* To permit an additional RADIUS client to communicate with the
 server.
@@ -49,9 +47,7 @@ invalid response.
 If the server responds to the packet and the client accepts the
 response, then the test was successful, and the server may be halted.
 
-[[new-client-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What happens when the server receives a packet from a machine not
 listed in "clients.conf"?
index 6860cd0d18ba8a1e6966654be0bc4ecdb156541a..0d2eda1f1a4d963c4d96230d82dfa736ff6ac701 100644 (file)
@@ -1,6 +1,4 @@
-[[new-user]]
-Adding a new user to the server
--------------------------------
+= Adding a new user to the server
 
 *Goal:* To configure the server with a new user, to send test packets as
 that new user, and to receive a reply.
@@ -81,9 +79,7 @@ from the previous test with a PAP password and incorrect shared secret.
 
 Stop the server.
 
-[[new-user-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What happens when using a PAP password with an incorrect shared secret, and why do we get this result?
 2.  What is different when using a CHAP password with an incorrect shared secret?
index 16a6e95bc2fdec97f10e1499b50124a48d6695b3..ac2dd7032cba66fbcc876221813c64d089356e12 100644 (file)
@@ -1,6 +1,4 @@
-[[prepaid]]
-A simple pre-paid example
--------------------------
+= A simple pre-paid example
 
 *Goal:* To implement a simple "prepaid" functionality in the server.
 
@@ -34,9 +32,7 @@ server another login request (`bob.sh`), and observe that the
 should be near 3600. This value depends on the length of time passed
 between when the server is started and when the `bob-acct-stop.sh` script is run.
 
-[[prepaid-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  How would you configure the server to obtain the daily access limits
 from an SQL database?
index 4112947651474da5b6970bb7347fae9a15e66d83..62cbb2e8f65ac419b53d7cf2abebf5f675bba51e 100644 (file)
@@ -1,6 +1,4 @@
-[[proxy]]
-Configuring a server to proxy requests
---------------------------------------
+= Configuring a server to proxy requests
 
 *Goal:* To configure the server to proxy packets to a remote (home)
 RADIUS server and to perform test authentications against both the
@@ -48,9 +46,7 @@ re-attempt the `bob@realm1.sh` authentication request to their server.
 They should then observe the resulting behavior of their server, as it
 attempts to proxy to a home server that does not respond.
 
-[[proxy-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  How would you configure "proxy.conf" so that "realm1" was not
 proxied, but was instead handled by the local RADIUS server?
index 39f097a194d81ffaf99e32cef0dcc1c1fc784450..7c1bc88e886755ac0c676c2a5dc49eb56333137f 100644 (file)
@@ -1,6 +1,4 @@
-[[proxy-fail-over]]
-Proxy Fail-over
----------------
+= Proxy Fail-over
 
 *Goal:* To configure a "backup" home server that is used when the
 "primary" home server fails.
@@ -57,9 +55,7 @@ group should observe the resulting behavior of the server for "realm1".
 If time permits, the group may switch roles, so that users have the
 opportunity to set up a proxy and a home server.
 
-[[proxy-fail-over-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Which server for "realm2" is picked by "realm1"? Why?
 2.  Would the server for "realm1" ever again try to send packets to
index 57259356d9697dbfa20b084234c86885fa371acc..6255f3db27b9f7ab82fec97aefc7d87f77817838 100644 (file)
@@ -1,6 +1,4 @@
-[[proxy-load-balance]]
-Proxy Load Balancing
---------------------
+= Proxy Load Balancing
 
 *Goal:* To configure a server to load-balanceproxied requests across
 multiple home servers.
@@ -23,9 +21,7 @@ User 1 will edit his `proxy.conf` file, so that the entries for
 requests to the server for "realm1", and observe how the proxied
 requests are distributed among the servers for "realm2".
 
-[[proxy-load-balance-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why is load balancing useful?
 2.  How is load balancing different than fail-over?
index 132a19f99b71bdfe35eb31f8d702973dd1aa4893..b9850ba197ff9a662f2b2af46ff7376dd66f6e4d 100644 (file)
@@ -1,6 +1,4 @@
-[[configuring_a_server_to_send_and_receive_proxy_requests]]
-Configuring a server to send and receive proxy requests
--------------------------------------------------------
+= Configuring a server to send and receive proxy requests
 
 *Goal:* To configure the server to proxy packets to a remote (home)
 RADIUS server and to receive packets from another proxy server.
@@ -66,9 +64,7 @@ be proxied. Both users should examine the debug logs of User 1’s
 RADIUS client and server in order to observe what the server's resulting behavior
 will be.
 
-[[proxy-receive-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why is it necessary for each server to mark some realms as local?
 2.  What would happen if each user did not configure the other RADIUS
index 8faf9aa6f037903e10ae25414fe3f0f044342dbc..81abb9c8aa9d57dd961eb75f1dce4881b045247c 100644 (file)
@@ -1,6 +1,4 @@
-[[radmin]]
-The Administration CLI
-----------------------
+= The Administration CLI
 
 *Goal:* To understand how to use the `radmin` command.
 
@@ -21,9 +19,7 @@ debugging mode. Connect to the control socket via `radmin`. Type `help`,
 and read the output. Use `radtest` to send the server packets, and see
 how the statistics change.
 
-[[radmin-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  How can you modify the `control-socket` file so that you can change
 the server configuration?
index 17cdb913636b7f168330fa7221521a83e8d3fea6..a4762f7cf941c29a82ff14602fc4c469807238be 100644 (file)
@@ -1,6 +1,5 @@
 [[simultaneous-use]]
-Configuring users for limited simultaneous access
--------------------------------------------------
+= Configuring users for limited simultaneous access
 
 *Goal:* To prevent a user from having more than one login session at a
 time.
@@ -48,9 +47,7 @@ After running the `bob-acct-stop.sh` script, you should run the
 `bob-login-two.sh` script again, to verify that the other login attempt
 is now permitted to succed.
 
-[[simultaneous-use-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why is it useful to prevent a user from having more than one
 simultaneous login session?
index 136831bee3d36d44077900e40b6a8d2fb7c72ad2..450e5137fd0fdd106c0e5ae2b732d2e341a76faf 100644 (file)
@@ -1,6 +1,4 @@
-[[sql]]
-Communicating with an SQL database
-----------------------------------
+= Communicating with an SQL database
 
 *Goal:* To configure the server to communicate with an SQL database.
 
@@ -164,9 +162,7 @@ client which may be used to perform this test.
 Now stop the server. The next exercise will be to add the schema to the
 database, and to populate it with a test entry.
 
-[[sql-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why is it important to test SQL connectivity, independently of
 testing the ability to obtain user configuration from an SQL database?
index 663049e8b53def6a51e77577b304ad0f814e3112..fd87152d5648b4c6e3e37b9d0e114bebdf723395 100644 (file)
@@ -1,6 +1,4 @@
-[[sql-user]]
-Configuring a user in an SQL database
--------------------------------------
+= Configuring a user in an SQL database
 
 *Goal:* To configure the server to have a new user in an SQL database,
 to send test packets as that user, and to receive a reply.
@@ -81,9 +79,7 @@ perform those queries by hand, using an SQL test client. Once you have
 verified that the SQL test client returns the correct information for
 the queries, then send the access request again.
 
-[[sql-user-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why do we not use an SQL database to "authenticate" users?
 2.  How do we have a DEFAULT entry in an SQL database?
diff --git a/doc/antora/modules/tutorials/pages/unlang_conditions.adoc b/doc/antora/modules/tutorials/pages/unlang_conditions.adoc
deleted file mode 100644 (file)
index bd87e20..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-[[unlang-conditions]]
-Unlang Conditions
------------------
-
-*Goal:* Explore uses of conditions in the policy language
-
-*Time:* 10-20 minutes
-
-*File:*  
-
-- `etc/raddb/policy.d/*`
-
-*`man` page:* unlang
-
-*documentation page(s):*
-
-- xref:unlang:condition/index.adoc[Conditions]
-- xref:unlang:update.adoc[The Update Statement]
-
-The functionality of some modules can be replicated or augmented
-using the policy language.
-
-There are many reasons why you may want to change exactly how a module
-works, but the most common are to implement additional business logic
-or deal with failures in a specific way.
-
-The `suffix` module is used to split an incoming `User-Name` value into
-its components and setup the request for proxying.
-
-Create a policy "suffix" that splits an incoming `User-Name` into two
-components on the "@" separator.
-
-The first component should be written to the `&request:Stripped-User-Name`
-attribute and the second component should be written to the
-`&control:Proxy-To-Realm` attribute.
-
-Use `bob@realm1.sh` and `bob@realm2.sh` to test your new policy to ensure
-it works as expected.
-
-[[unlang-conditions-questions]]
-Questions
-~~~~~~~~~
-
-1.  What is one feature of the regular expression operator which make
-    it particularly powerful in unlang?
-2.  Why might you want to re-implement functionality offered by modules
-    in unlang?
-3.  What is the advantage of using `return` to exit the section early?
-
-// Copyright (C) 2019 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
-// Development of this documentation was sponsored by Network RADIUS SAS.
index 4397e2f27a383e3cac6697bc03b31caeaaa1285e..8d7f4f3e3232bee87a463c027875e17dae91215f 100644 (file)
@@ -1,6 +1,4 @@
-[[unlang-policies]]
-Unlang Policies
----------------
+= Unlang Policies
 
 *Goal:* Create and use policies for abstracting business logic
 
@@ -12,6 +10,8 @@ Unlang Policies
 
 *`man` page:* unlang
 
+include::partial$unlang_start.adoc[]
+
 Look through the existing files in `etc/raddb/policy.d/*` and `man unlang`
 to get a feel for the unlang syntax and the tasks that policies can
 be used for.
@@ -41,10 +41,11 @@ authorize {
 ------------------------------------------------
 
 Create a policy `proxy_to_realm` that forwards the incoming request
-to to a remote realm if the `User-Name` attribute ends in `@<remote realm>`,
-then use the `return` keyword to exit the authorize section.
-If the `User-Name` attribute does not end in `@<remote realm>` the policy
-should return `noop`, so the caller knows that it did nothing.
+to to a remote realm if the `User-Name` attribute ends in `@<remote realm>`.
+
+The contents of this policy should be identical to the the 'unlang'
+code written for the xref:unlang_splitting_strings.adoc[Splitting Strings]
+tutorial.
 
 Call this policy at the start of the `authorize {}` section of the
 `etc/raddb/sites-available/default` virtual server.
@@ -52,30 +53,12 @@ Call this policy at the start of the `authorize {}` section of the
 All the information you need to create this policy is contained within
 `man unlang` pages and the examples in this exercise.
 
-[TIP]
-========================================================================
-Attributes in the `&control` list can control the behaviour of the server.
-Commonly used control attributes are:
-
-- `&control:Proxy-To-Realm` controls the realm that the incoming request
-is forwarded to.
-- `&control:Response-Packet-Type` overrides the RADIUS packet code
-FreeRADIUS responds with.
-- `&control:Autz-Type` specifies the `autz-type {}` section to run in the
-`authorize {}` section.
-- `&control:Auth-Type` specifies the `auth-type {}` section to run in the
-`authenticate {}` section.
-========================================================================
-
-[[unlang-policies-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What are the advantages of using the policy language over interpreted
     language modules?
-2.  What's the main difference between a policy and a function in other
+2.  What are the main differences between a policy and a function in other
     languages?
-3.  What is the advantage of using `return` to exit the section early?
 
 // Copyright (C) 2019 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
 // Development of this documentation was sponsored by Network RADIUS SAS.
diff --git a/doc/antora/modules/tutorials/pages/unlang_return_codes.adoc b/doc/antora/modules/tutorials/pages/unlang_return_codes.adoc
new file mode 100644 (file)
index 0000000..d8bb89e
--- /dev/null
@@ -0,0 +1,13 @@
+= Module return codes
+
+*Goal:* Create and use policies for abstracting business logic
+
+*Time:* 10-20 minutes
+
+*File:*
+
+- `etc/raddb/policy.d/*`
+
+*`man` page:* unlang
+
+include::partial$unlang_start.adoc[]
diff --git a/doc/antora/modules/tutorials/pages/unlang_splitting_strings.adoc b/doc/antora/modules/tutorials/pages/unlang_splitting_strings.adoc
new file mode 100644 (file)
index 0000000..50aa1f9
--- /dev/null
@@ -0,0 +1,58 @@
+= Splitting strings
+
+*Goal:* Explore uses of regular expressions and subcapture groups
+
+*Time:* 10-20 minutes
+
+*File:*  
+
+- `etc/raddb/policy.d/*`
+
+*`man` page:* unlang
+
+*documentation page(s):*
+
+- xref:unlang:condition/index.adoc[Conditions]
+- xref:unlang:condition/regex.adoc[Regular expressions]
+- xref:unlang:update.adoc[The Update Statement]
+
+include::partial$unlang_start.adoc[]
+
+include::partial$common_control_attrs_sidebar.adoc[]
+
+Regular expressions are an extremely powerful tool in the 'unlang' policy
+language.  They provide both validation capabilities, allowing users
+to check the format of incoming attributes, and substring extraction
+(via capture groups).
+
+If you've completed the xref:proxy.adoc[Proxy] exercise you'll have
+used the `suffix` module to split an incoming `&User-Name` value into
+its components and setup the request for proxying.
+
+Create an unlang version of "suffix" that splits an incoming `&User-Name` into
+two components on the "@" separator.
+
+The first component should be written to the `&request:Stripped-User-Name`
+attribute and the second component should be written to the
+`&control:Stripped-User-Domain` attribute.
+
+Use `bob@realm1.sh` and `bob@realm2.sh` to test your new policy to ensure
+it works as expected.
+
+If you've completed the xref:proxy.adoc[Proxy] tutorial and have test
+realms setup, modify the policy code you have just written to proxy
+the request to the realm specified in the `&User-Name` attribute.
+
+== Questions
+
+1.  Regular expressions can contain attribute expansions.  Given that
+    all supported regular expression libraries support pre-compilation
+    of expressions, why would regular expressions containing expansions
+    be avoided when the server being deployed will be under heavy load?
+2.  Why might you want to re-implement functionality offered by modules
+    in unlang?
+3.  What is an advantage of using expression based string splitting
+    over the suffix module?
+
+// Copyright (C) 2019 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
+// Development of this documentation was sponsored by Network RADIUS SAS.
diff --git a/doc/antora/modules/tutorials/pages/unlang_update_blocks_and_conditions.adoc b/doc/antora/modules/tutorials/pages/unlang_update_blocks_and_conditions.adoc
new file mode 100644 (file)
index 0000000..3efb33d
--- /dev/null
@@ -0,0 +1,77 @@
+= Update blocks and simple conditions
+
+*Goal:* Explore uses of update blocks in the policy language
+
+*Time:* 10-25 minutes
+
+*File:*  
+
+- `sites-available/default`
+
+*`man` page:* unlang
+
+*documentation page(s):*
+
+- xref:unlang:condition/index.adoc[Conditions]
+- xref:unlang:update.adoc[The Update Statement]
+
+include::partial$unlang_start.adoc[]
+
+Unlang `update` blocks are used to update one or attributes in one
+of the server's xref:unlang:list.adoc[attribute lists].s
+
+One common use of `update` blocks is to alter how a server processes
+requests.
+
+In previous tutorials we've used the `files` modules, and the authorize
+methods of authentication modules such as `pap` and `chap` to alter how
+the server processes requests.  Here, we will emulate that behaviour
+using the policy language.
+
+* Create a condition (_condition 1_) to execute policy code if
+the `&User-Name` in the request is 'bob'.
+* Within that condition block, set the control attribute `&Cleartext-Password`
+to be 'hello', and instruct the server to run the the `authenticate { ... }`
+subsection for `pap`.
+* Use the `bob.sh` script to verify that you see an `Access-Accept` returned
+despite the `files` module not being called.
+
+Using additional conditions and update blocks, emulate the logic implemented
+using the files module in the xref:matching_users.adoc[Matching Users]
+exercise.
+
+To recap:
+
+* If an incoming request contains a `&User-Name` attribute with the value
+  'bob', and contains and attribute `&Framed-Protocol` with value `PPP`
+  (_condition 2_), reply with a `&Framed-IP-Address` attribute with the value
+  `192.168.10.12`.
+* If an incoming request contains a `&Service-Type` attribute with a value
+  of `Framed-User` (_condition 3_), reply with a `&Framed-Route` attribute
+  assigning a default route of `192.168.10.1` (`0.0.0.0/0 192.168.10.1 1`) and
+  a `&Framed-IP-Netmask` attribute with a value of `255.255.255.0`.
+
+Again test the server with username "bob" and password "hello". Use the
+debug output of the server to see which unlang conditions evaluated to
+true.  You may use `radclient` or the `bob.sh` script to send the packets.
+
+Perform other authentication tests, adding the appropriate attributes to
+the test requests to exercise the different conditions. If you already have
+test packets from the xref:matching_users.adoc[Matching Users] exercises,
+you may use those, otherwise continue until you have packets that will match:
+
+* conditions 1 and 2, but not 3.
+* conditions 1 and 3, but not 2.
+* conditions 1, 2, and 3.
+
+== Questions
+
+1.  What are the advantages of unlang over the files module when creating
+    policies?
+2.  What are the advantages of the files modules over unlang?  Are there
+    any situations where you think the files module might be better suited
+    to a task than unlang?
+3.  Can you think of any efficiencies the users module might have over
+    multiple conditions, where policies are being assigned to many different
+    users.
+
index cda3adb7756775c256ed732d2f978be6e0ed1035..edf02a8ceb4bc60acf4cbcc288ad51b33056c7b1 100644 (file)
@@ -1,6 +1,4 @@
-[[variables]]
-Using configuration and run-time variables
-------------------------------------------
+= Using configuration and run-time variables
 
 *Goal:* To use run-time variable expansion.
 
@@ -84,9 +82,7 @@ Start the server, and run the `bob-login-one.sh` script. Verify that the
 `Reply-Message` attributes contain the user name, NAS port, time, and a
 copy of the `Class` attribute from the reply.
 
-[[variables-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  Why are run-time variables useful?
 2.  How would you configure that entry in the file to reply with the
index 89283be6ebf6ee2bc62ce8b175077ad2642aee71..f2b9f045be54a5c55ebd17ac127e17b5f34d0332 100644 (file)
@@ -1,6 +1,4 @@
-[[virtual]]
-Virtual Servers
----------------
+= Virtual Servers
 
 *Goal:* To understand how to create and use a new virtual server.
 
@@ -49,9 +47,7 @@ authenticate {
 Start the server in debugging mode, and use `radtest` to send a PAP
 authentication request to the server at the port defined above.
 
-[[virtual-questions]]
-Questions
-~~~~~~~~~
+== Questions
 
 1.  What happens when you try to use CHAP or MS-CHAP? Why does this result occur?
 2.  How can you make that virtual server use CHAP or MS-CHAP?
diff --git a/doc/antora/modules/tutorials/partials/common_control_attrs_sidebar.adoc b/doc/antora/modules/tutorials/partials/common_control_attrs_sidebar.adoc
new file mode 100644 (file)
index 0000000..7f7bf3c
--- /dev/null
@@ -0,0 +1,14 @@
+.Common control attributes
+****
+Attributes in the `&control` list can control the behaviour of the server.
+Commonly used control attributes are:
+
+- `&control:Proxy-To-Realm` controls the realm that the incoming request
+is forwarded to.
+- `&control:Response-Packet-Type` overrides the RADIUS packet code
+FreeRADIUS responds with.
+- `&control:Autz-Type` specifies the `autz-type {}` section to run in the
+`authorize {}` section.
+- `&control:Auth-Type` specifies the `auth-type {}` section to run in the
+`authenticate {}` section.
+****
diff --git a/doc/antora/modules/tutorials/partials/unlang_start.adoc b/doc/antora/modules/tutorials/partials/unlang_start.adoc
new file mode 100644 (file)
index 0000000..73f3034
--- /dev/null
@@ -0,0 +1,6 @@
+[TIP]
+====
+For this tutorial you should start with an empty authorization section
+(`recv Access-Request { ... }` or in ≤ v3.0.x `authorize { ... }`)
+in the virtual server you're using to process requests.
+====
index 0b84c23baf4db48638178e5aa4bca5158f36f47a..935c8ad2bdbe31cf33682d72f8a9baee1a8de8f4 100644 (file)
@@ -2,7 +2,6 @@
 
 ** xref:list.adoc[Attribute Lists]
 ** xref:attr.adoc[Attribute References]
-** xref:regex.adoc[Regular Expressions]
 
 ** xref:keywords.adoc[Keywords]
 *** xref:break.adoc[break]
@@ -47,6 +46,7 @@
 *** xref:condition/or.adoc[The '||' Operator]
 *** xref:condition/not.adoc[The '!' Operator]
 *** xref:condition/para.adoc[The '( )' Operator]
+*** xref:condition/regex.adoc[Regular Expressions]
 
 
 ** xref:xlat/index.adoc[String Expansion]
index b7a04f2620d41ce260a4b5a83c328d692d5c9208..dafbef4ce8b74591023f90faa860202f374ea881 100644 (file)
@@ -25,12 +25,12 @@ The comparison operators are given below.
 | != | not equals
 | >= | greater than or equals
 | >  | greater than
-| xref:regex.adoc[=~] | regular expression matches
-| xref:regex.adoc[!~] | regular expression does not match
+| xref:condition/regex.adoc[=~] | regular expression matches
+| xref:condition/regex.adoc[!~] | regular expression does not match
 |=====
 
 The comparison operators perform _type-specific_ comparisons.  The
-only exceptions are the xref:regex.adoc[regular expression] operators,
+only exceptions are the xref:condition/regex.adoc[regular expression] operators,
 which interpret the `lhs` as a printable string, and the `rhs` as a
 regular expression.
 
index 62b075689dd9bf93c9e15c0aefb903cd22fe4a56..dae692ae458f6a6f60d83a57ec1ed0b520b0faa9 100644 (file)
@@ -1,13 +1,13 @@
 = Built-in Modules
 
-In some cases, it is useful to reject a request immediately or
-perform another action on it.  The built-in modules can be used to perform these actions.  These modules are named for the return codes given in the
-xref:module.adoc[module] section.
+In some cases, it is useful to reject a request immediately or perform another
+action on it.  The built-in modules can be used to perform these actions.  These
+modules are named for the return codes given in the xref:module.adoc[module]
+section.
 
 In practice, these modules are implemented by the
-xref:../raddb/mods-available/always.adoc[always] module and exist so that a
-success or failure can be forced during the processing of a
-policy.
+xref:raddb:mods-available/always.adoc[always] module and exist so that a
+success or failure can be forced during the processing of a policy.
 
 The names and behaviours of these modules are given below: