<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/405/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ratna</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/405/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ratna"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/Special:Contributions/Ratna"/>
	<updated>2026-05-16T06:33:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Installation_on_Ubuntu_using_Git&amp;diff=151195</id>
		<title>Talk:Installation on Ubuntu using Git</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Installation_on_Ubuntu_using_Git&amp;diff=151195"/>
		<updated>2025-03-18T12:39:33Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This old documentation uses PHP 5, but current Moodle 3.5 should use PHP 7&lt;br /&gt;
&lt;br /&gt;
&amp;quot;current Moodle 3.5&amp;quot;? This is the Moodle 4.5 LTS page!&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149281</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149281"/>
		<updated>2024-09-09T05:11:35Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==What is Shibboleth==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==auth/shibboleth/README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable Shibboleth federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK [https://en.wikipedia.org/wiki/Becta Becta] and [https://www.jisc.ac.uk/about-us JISC] have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Swiss Authentication and Authorization Infrastructure (SWITCHaai)===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation called [https://help.switch.ch/aai/ Swiss Authentication and Authorization Infrastructure (SWITCHaai)] encompassing about 160 institutions and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id Switch edu-ID] covering around 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
Here are the steps required in a specific federation as an example to demonstrate the components involved.&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Configuring service provider===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Get federation metadata signing certificate federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Edit the main Shibboleth configuration file /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
3.1 Change the entityID in the ApplicationDefaults tag to your service&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Plan for the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Create SP metadata credentials&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
5. Start the shibboleth service for Apache&lt;br /&gt;
&lt;br /&gt;
5.1 Test the configuration before starting the service:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
  [possible errors or warnings]&lt;br /&gt;
  overall configuration is loadable, check console or log for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
You need to study the errors or warnings, if there are any, before continuing.&lt;br /&gt;
&lt;br /&gt;
5.2 Start the service:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
6.1 To activate shibboleth login on Apache protect the /PATH/TO/MOODLE/auth/shibboleth/index.php file by Shibboleth. Also add the SSL certificates to the /etc/apache2/sites-available/SOMETHING.conf file:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
===Configuring the identity provider===&lt;br /&gt;
&lt;br /&gt;
7. Register the site with the federation&lt;br /&gt;
&lt;br /&gt;
The site needs to be registered with the federation so that its WAYF go to the discovery service divert you to the correct IdP.&lt;br /&gt;
&lt;br /&gt;
7.1 Get the metadata of the application&lt;br /&gt;
&lt;br /&gt;
It is available at the URL https://DOMAIN/Shibboleth.sso/Metadata. &lt;br /&gt;
&lt;br /&gt;
7.2 Submit the metadata and your administrative information to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. The administrators of the federation must have shared the link with you. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
8.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
8.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Moodle needs the four fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039; and &#039;Email&#039; at a minimum to create an account. So you should map them to corrosponding attributes in the IdP database. You have to set this data-mapping under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; , etc. Here is again a typical set:&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all the above three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
In addition make the following changes:&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may visit ​https://DOMAIN/login/ and choose Shibboleth to be taken to the federation WAYF.&lt;br /&gt;
&lt;br /&gt;
==How to debug==&lt;br /&gt;
* Visit https://DOMAIN/Shibboleth.sso/Login. You should be taken to the federation discovery service where you need to select your IdP. From there you&#039;ll be taken to your IdP login page. Once your credentials are accepted you&#039;ll be taken back to the Moodle site. Once in there visit https://DOMAIN/Shibboleth.sso/Session. It should show all the required attributes as in this example:&lt;br /&gt;
&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=File:test_screenshot.png&amp;diff=149280</id>
		<title>File:test screenshot.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=File:test_screenshot.png&amp;diff=149280"/>
		<updated>2024-09-08T15:15:36Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149279</id>
		<title>Talk:Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149279"/>
		<updated>2024-09-08T14:31:05Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See the original discussion: [https://moodle.org/mod/forum/discuss.php?d=461370 &amp;quot;Shibboleth&amp;quot; Moodle as the SP doesn&#039;t get the attributes filled from the IdP]&lt;br /&gt;
&lt;br /&gt;
--[[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] ([[User talk:Visvanath Ratnaweera|talk]]) 14:30, 8 September 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149269</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149269"/>
		<updated>2024-09-08T10:25:01Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==What is Shibboleth==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==auth/shibboleth/README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Swiss Authentication and Authorization Infrastructure (SWITCHaai)===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation called [https://help.switch.ch/aai/ Swiss Authentication and Authorization Infrastructure (SWITCHaai)] encompassing about 160 institutions and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id Switch edu-ID] covering around 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
Here are the steps required in a specific federation as an example to demonstrate the components involved.&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Configuring service provider===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Get federation metadata signing certificate federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Edit the main Shibboleth configuration file /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
3.1 Change the entityID in the ApplicationDefaults tag to your service&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Plan for the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Create SP metadata credentials&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
5. Start the shibboleth service for Apache&lt;br /&gt;
&lt;br /&gt;
5.1 Test the configuration before starting the service:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
  [possible errors or warnings]&lt;br /&gt;
  overall configuration is loadable, check console or log for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
You need to study the errors or warnings, if there are any, before continuing.&lt;br /&gt;
&lt;br /&gt;
5.2 Start the service:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
6.1 To activate shibboleth login on Apache protect the /PATH/TO/MOODLE/auth/shibboleth/index.php file by Shibboleth. Also add the SSL certificates to the /etc/apache2/sites-available/SOMETHING.conf file:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
===Configuring the identity provider===&lt;br /&gt;
&lt;br /&gt;
7. Register the site with the federation&lt;br /&gt;
&lt;br /&gt;
The site needs to be registered with the federation so that its WAYF go to the discovery service divert you to the correct IdP.&lt;br /&gt;
&lt;br /&gt;
7.1 Get the metadata of the application&lt;br /&gt;
&lt;br /&gt;
It is available at the URL https://DOMAIN/Shibboleth.sso/Metadata. &lt;br /&gt;
&lt;br /&gt;
7.2 Submit the metadata and your administrative information to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. The administrators of the federation must have shared the link with you. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
8.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
8.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Moodle needs the four fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039; and &#039;Email&#039; at a minimum to create an account. So you should map them to corrosponding attributes in the IdP database. You have to set this data-mapping under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; , etc. Here is again a typical set:&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all the above three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
In addition make the following changes:&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may visit ​https://DOMAIN/login/ and choose Shibboleth to be taken to the federation WAYF.&lt;br /&gt;
&lt;br /&gt;
==How to debug==&lt;br /&gt;
* Visit https://DOMAIN/Shibboleth.sso/Login. You should be taken to the federation discovery service where you need to select your IdP. From there you&#039;ll be taken to your IdP login page. Once your credentials are accepted you&#039;ll be taken back to the Moodle site. Once in there visit https://DOMAIN/Shibboleth.sso/Session. It should show all the required attributes as in this example:&lt;br /&gt;
&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149263</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149263"/>
		<updated>2024-09-08T07:51:27Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==What is Shibboleth==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==auth/shibboleth/README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Swiss Authentication and Authorization Infrastructure (SWITCHaai)===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation called [https://help.switch.ch/aai/ Swiss Authentication and Authorization Infrastructure (SWITCHaai)] encompassing about 160 institutions and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id Switch edu-ID] covering around 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
Here are the steps required in a specific federation as an example to demonstrate the components involved.&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Configuring service provider===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Edit the /etc/shibboleth/shibboleth2.xml file&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Create SP metadata credentials&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
5. Start the shibboleth service for Apache&lt;br /&gt;
&lt;br /&gt;
5.1 Test the configuration before starting the service:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
  [possible errors or warnings]&lt;br /&gt;
  overall configuration is loadable, check console or log for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
You need to study the errors or warnings, if there are any, before continuing.&lt;br /&gt;
&lt;br /&gt;
5.2 Start the service:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
6.1 To activate shibboleth login on Apache protect the /PATH/TO/MOODLE/auth/shibboleth/index.php file by Shibboleth. Also add the SSL certificates to the /etc/apache2/sites-available/SOMETHING.conf file:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
===Configuring the identity provider===&lt;br /&gt;
&lt;br /&gt;
7. Register the site with the federation&lt;br /&gt;
&lt;br /&gt;
The site needs to be registered with the federation so that its WAYF go to the discovery service divert you to the correct IdP.&lt;br /&gt;
&lt;br /&gt;
7.1 Get the metadata of the application&lt;br /&gt;
&lt;br /&gt;
It is available at the URL https://DOMAIN/Shibboleth.sso/Metadata. &lt;br /&gt;
&lt;br /&gt;
7.2 Submit the metadata and your administrative information to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. The administrators of the federation must have shared the link with you. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
8.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
8.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Moodle needs the four fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039; and &#039;Email&#039; at a minimum to create an account. So you should map them to corrosponding attributes in the IdP database. You have to set this data-mapping under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; , etc. Here is again a typical set:&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
In addition make the following changes:&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may visit ​https://DOMAIN/login/ and choose Shibboleth to be taken to the federation WAYF.&lt;br /&gt;
&lt;br /&gt;
==In case of problems==&lt;br /&gt;
* Visit https://DOMAIN/Shibboleth.sso/Login. You should be taken to the Federation fds page where you need to select your IdP. From there you&#039;ll be taken to your IdP login page. Once you enter your credentials you&#039;ll be taken back to your Moodle site. Once in there visit https://DOMAIN/Shibboleth.sso/Session. It should show all the required attributes as in this example:&lt;br /&gt;
&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149262</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149262"/>
		<updated>2024-09-08T07:50:35Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==What is Shibboleth==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==auth/shibboleth/README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Swiss Authentication and Authorization Infrastructure (SWITCHaai)===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation called [https://help.switch.ch/aai/ Swiss Authentication and Authorization Infrastructure (SWITCHaai)] encompassing about 160 institutions and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id Switch edu-ID] covering around 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
Here are the steps required in a specific federation as an example to demonstrate the components involved.&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Configuring service provider===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Edit the /etc/shibboleth/shibboleth2.xml file&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Create SP metadata credentials&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
5. Start the shibboleth service for Apache&lt;br /&gt;
&lt;br /&gt;
5.1 Test the configuration before starting the service:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
  [possible errors or warnings]&lt;br /&gt;
  overall configuration is loadable, check console or log for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
You need to study the errors or warnings, if there are any, before continuing.&lt;br /&gt;
&lt;br /&gt;
5.2 Start the service:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
6.1 To activate shibboleth login on Apache protect the /PATH/TO/MOODLE/auth/shibboleth/index.php file by Shibboleth. Also add the SSL certificates to the /etc/apache2/sites-available/SOMETHING.conf file:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
===Configuring the identity provider===&lt;br /&gt;
&lt;br /&gt;
7. Register the site with the federation&lt;br /&gt;
&lt;br /&gt;
The site needs to be registered with the federation so that its WAYF go to the discovery service divert you to the correct IdP.&lt;br /&gt;
&lt;br /&gt;
7.1 Get the metadata of the application&lt;br /&gt;
&lt;br /&gt;
It is available at the URL https://DOMAIN/Shibboleth.sso/Metadata. &lt;br /&gt;
&lt;br /&gt;
7.2 Submit the metadata and your administrative information to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. The administrators of the federation must have shared the link with you. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
8.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
8.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Moodle needs the four fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039; and &#039;Email&#039; at a minimum to create an account. So you should map them to corrosponding attributes in the IdP database. You have to set this data-mapping under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; , etc. Here is again a typical set:&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
In addition make the following changes:&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may visit ​https://DOMAIN/login/ and choose Shibboleth to be taken to the federation WAYF.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
* Visit https://DOMAIN/Shibboleth.sso/Login. You should be taken to the Federation fds page where you need to select your IdP. From there you&#039;ll be taken to your IdP login page. Once you enter your credentials you&#039;ll be taken back to your Moodle site. Once in there visit https://DOMAIN/Shibboleth.sso/Session. It should show all the required attributes as in this example:&lt;br /&gt;
&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149261</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149261"/>
		<updated>2024-09-08T07:02:57Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Renumbering the SP config section. Debugging section started&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==What is Shibboleth==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==auth/shibboleth/README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Swiss Authentication and Authorization Infrastructure (SWITCHaai)===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation called [https://help.switch.ch/aai/ Swiss Authentication and Authorization Infrastructure (SWITCHaai)] encompassing about 160 institutions and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id Switch edu-ID] covering around 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
Here are the steps required in a specific federation as an example to demonstrate the components involved.&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Configuring SP (Moodle) side===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Edit the /etc/shibboleth/shibboleth2.xml file&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Create SP metadata credentials&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
5. Start the shibboleth service for Apache&lt;br /&gt;
&lt;br /&gt;
5.1 Test the configuration before starting the service:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
  [possible errors or warnings]&lt;br /&gt;
  overall configuration is loadable, check console or log for non-fatal problems&lt;br /&gt;
&lt;br /&gt;
You need to study the errors or warnings, if there are any, before continuing.&lt;br /&gt;
&lt;br /&gt;
5.2 Start the service:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
6.1 To activate shibboleth login on Apache protect the /PATH/TO/MOODLE/auth/shibboleth/index.php file by Shibboleth. Also add the SSL certificates to the /etc/apache2/sites-available/SOMETHING.conf file:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Register the site with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
7.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
7.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
8.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
8.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
* Visit https://DOMAIN/Shibboleth.sso/Login. You should be taken to the Federation fds page where you need to select your IdP. From there you&#039;ll be taken to your IdP login page. Once you enter your credentials you&#039;ll be taken back to your Moodle site. Once in there visit https://DOMAIN/Shibboleth.sso/Session. It should show all the required attributes as in this example:&lt;br /&gt;
&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149246</id>
		<title>Talk:Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149246"/>
		<updated>2024-09-03T20:28:10Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Original discussion: [https://moodle.org/mod/forum/discuss.php?d=461370 &amp;quot;Shibboleth&amp;quot; Moodle as the SP doesn&#039;t get the attributes filled from the IdP]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149245</id>
		<title>Talk:Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149245"/>
		<updated>2024-09-03T20:27:25Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Original discussion: [https://moodle.org/mod/forum/discuss.php?d=461370 [Shibboleth] Moodle as the SP doesn&#039;t get the attributes filled from the IdP]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149244</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149244"/>
		<updated>2024-09-03T20:16:20Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==What is Shibboleth==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==auth/shibboleth/README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Swiss Authentication and Authorization Infrastructure (SWITCHaai)===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation called [https://help.switch.ch/aai/ Swiss Authentication and Authorization Infrastructure (SWITCHaai)] encompassing about 160 institutions and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id Switch edu-ID] covering around 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
Here are the steps required in a specific federation as an example to demonstrate the components involved.&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
  # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
(to come)&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149243</id>
		<title>Talk:Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Shibboleth&amp;diff=149243"/>
		<updated>2024-09-03T19:46:49Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Created an empty page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Talk:Shibboleth&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149242</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149242"/>
		<updated>2024-09-03T19:22:51Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==About==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Shibboleth in Switzerland ===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation [https://help.switch.ch/aai/ SWITCHaai] and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id edu-ID]. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
  # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
(to come)&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149241</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149241"/>
		<updated>2024-09-03T19:21:45Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==About==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
==Some notable federations==&lt;br /&gt;
===UK Access Management Federation for Education and Research===&lt;br /&gt;
In the UK Becta and JISC have implemented the education federation [https://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research] using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
===Shibboleth in Switzerland ===&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation [https://help.switch.ch/aai/ SWITCHaai] and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id edu-ID]. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration in detail==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
  # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149240</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149240"/>
		<updated>2024-09-03T19:16:17Z</updated>

		<summary type="html">&lt;p&gt;Ratna: /* Shibboleth in Switzerland */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==About==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs the federation [https://help.switch.ch/aai/ SWITCHaai] and a universal login  for all living in Switzerland under [https://www.switch.ch/edu-id edu-ID]. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
  # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149239</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149239"/>
		<updated>2024-09-03T18:58:46Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==About==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
  &lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
  &lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
  &lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
  &lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
  &lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
  &lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
  &lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
  &lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE in the document could mean /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
  # /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
  # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
  # systemctl start shibd&lt;br /&gt;
  # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
  &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      ServerName DOMAIN&lt;br /&gt;
      ServerAdmin YOU@DOMAIN&lt;br /&gt;
      DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
  &lt;br /&gt;
      ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
      CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
      &lt;br /&gt;
      SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
      SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
       # just comment out&lt;br /&gt;
       # ShibRequestSetting applicationId mdl&lt;br /&gt;
    &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      # just comment out the next line and add the two lines below that&lt;br /&gt;
      # ShibRequestSetting applicationId mdl&lt;br /&gt;
      ShibRequireSession On&lt;br /&gt;
      require valid-user&lt;br /&gt;
     &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
  &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149238</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149238"/>
		<updated>2024-09-03T18:42:38Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
==About==&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
&lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
&lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
&lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
&lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
&lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
&lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
&lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
&lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;; &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  &lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  &lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE could be /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
    # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
    # systemctl start shibd&lt;br /&gt;
    # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
        &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                ServerName DOMAIN&lt;br /&gt;
                ServerAdmin YOU@DOMAIN&lt;br /&gt;
                DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
&lt;br /&gt;
                ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
                CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
        &lt;br /&gt;
                SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
                SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
                            # just comment out&lt;br /&gt;
                           # ShibRequestSetting applicationId mdl&lt;br /&gt;
                &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
                            AuthType shibboleth&lt;br /&gt;
                            # just comment out the next line and add the two lines below that&lt;br /&gt;
                            # ShibRequestSetting applicationId mdl&lt;br /&gt;
                            ShibRequireSession On&lt;br /&gt;
                            require valid-user&lt;br /&gt;
                &amp;lt;/Directory&amp;gt;&lt;br /&gt;
        &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149237</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149237"/>
		<updated>2024-09-03T18:37:05Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
Location: &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Shibboleth_(software) Shibboleth] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language Identity providers (IdP&#039;s)] supply user information, while [https://en.wikipedia.org/wiki/Service_provider_(SAML) service providers (SP&#039;s)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
  &lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
&lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
&lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
&lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
&lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
&lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
  &lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
  &lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
&lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
  &lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
  &lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
  &lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
  &lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
  &lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
&lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
  &lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  &lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
&lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  &lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
  &lt;br /&gt;
  Example file:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  &lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
  &lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
&lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
    }&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  &lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  &lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  &lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
&lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
  &lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE could be /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
    # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
    # systemctl start shibd&lt;br /&gt;
    # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
        &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                ServerName DOMAIN&lt;br /&gt;
                ServerAdmin YOU@DOMAIN&lt;br /&gt;
                DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
&lt;br /&gt;
                ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
                CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
        &lt;br /&gt;
                SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
                SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
                            # just comment out&lt;br /&gt;
                           # ShibRequestSetting applicationId mdl&lt;br /&gt;
                &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
                            AuthType shibboleth&lt;br /&gt;
                            # just comment out the next line and add the two lines below that&lt;br /&gt;
                            # ShibRequestSetting applicationId mdl&lt;br /&gt;
                            ShibRequireSession On&lt;br /&gt;
                            require valid-user&lt;br /&gt;
                &amp;lt;/Directory&amp;gt;&lt;br /&gt;
        &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Submit the metadata to the federation&lt;br /&gt;
&lt;br /&gt;
Usually there is a web site at the federation for you to upload the metadata and enter various administrative information. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
Under &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; the fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto them. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===In case of problems===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149236</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149236"/>
		<updated>2024-09-03T18:07:03Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
Location: &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
[Shibboleth https://en.wikipedia.org/wiki/Shibboleth_(software)] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [Identity providers (IdP&#039;s) https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language] supply user information, while [service providers (SP&#039;s) https://en.wikipedia.org/wiki/Service_provider_(SAML)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
&lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
- Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
&lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
&lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
&lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
&lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
&lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
&lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
&lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
&lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
&lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
&lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
&lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
&lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
&lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
&lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
&lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
&lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
&lt;br /&gt;
  Example file:&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
&lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
&lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
&lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
&lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
&lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE could be /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
    # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
    # systemctl start shibd&lt;br /&gt;
    # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
        &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                ServerName DOMAIN&lt;br /&gt;
                ServerAdmin YOU@DOMAIN&lt;br /&gt;
                DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
&lt;br /&gt;
                ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
                CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
        &lt;br /&gt;
                SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
                SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
                            # just comment out&lt;br /&gt;
                           # ShibRequestSetting applicationId mdl&lt;br /&gt;
                &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
                            AuthType shibboleth&lt;br /&gt;
                            # just comment out the next line and add the two lines below that&lt;br /&gt;
                            # ShibRequestSetting applicationId mdl&lt;br /&gt;
                            ShibRequireSession On&lt;br /&gt;
                            require valid-user&lt;br /&gt;
                &amp;lt;/Directory&amp;gt;&lt;br /&gt;
        &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Register the metadata with the federation&lt;br /&gt;
&lt;br /&gt;
Visit ​https://FEDERATTION/ and go to Join. You will be asked to upload the metadata on line and go through a couple of screens answering administrative questions. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
The fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto the corresponding Moodle variable. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===How to debug&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://incommon.org/software/shibboleth/ Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149235</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149235"/>
		<updated>2024-09-03T17:59:50Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Added auth/shibboleth/README.txt&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
&lt;br /&gt;
Location: &#039;&#039;Site administration &amp;gt; Plugins: Authentication &amp;gt; Shibboleth&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
[Shibboleth https://en.wikipedia.org/wiki/Shibboleth_(software) Wikipedia, Shibboleth_(software)] is a single sign-on log-in system for computer networks and the Internet. It allows people to sign in using just one identity to various systems run by federations of different organizations or institutions. The federations are often universities or public service organizations. &lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on [https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language SAML]. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. [Identity providers (IdP&#039;s) https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language] supply user information, while [service providers (SP&#039;s) https://en.wikipedia.org/wiki/Service_provider_(SAML)] consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==README.txt==&lt;br /&gt;
&lt;br /&gt;
This the auth/shibboleth/README.txt file in the Moodle distribution:&lt;br /&gt;
&lt;br /&gt;
  Shibboleth Authentication for Moodle&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  &lt;br /&gt;
  Requirements:&lt;br /&gt;
- Shibboleth Service Provider 1.3 or newer. Recommended is 2.1 or newer.&lt;br /&gt;
  See documentation for your Shibboleth federation on how to set up Shibboleth.&lt;br /&gt;
  &lt;br /&gt;
  Changes:&lt;br /&gt;
  - 11. 2004: Created by Markus Hagman&lt;br /&gt;
  - 05. 2005: Modifications to login process by Martin Dougiamas&lt;br /&gt;
  - 05. 2005: Various extensions and fixes by Lukas Haemmerle&lt;br /&gt;
  - 06. 2005: Adaptions to new field locks and plugin config structures by Martin&lt;br /&gt;
              Langhoff and Lukas Haemmerle&lt;br /&gt;
  - 10. 2005: Added better error messages and moved text to language directories&lt;br /&gt;
  - 02. 2006: Simplified authentication so that authorization works properly&lt;br /&gt;
              Added instructions for IIS&lt;br /&gt;
  - 11. 2006: User capabilities are now loaded properly as of Moodle 1.7+&lt;br /&gt;
  - 03. 2007: Adapted authentication method to Moodle 1.8&lt;br /&gt;
  - 07. 2007: Fixed a but that caused problems with uppercase usernames&lt;br /&gt;
  - 10. 2007: Removed the requirement for email address, surname and given name&lt;br /&gt;
              attributes on request of Markus Hagman&lt;br /&gt;
  - 11. 2007: Integrated WAYF Service in Moodle&lt;br /&gt;
  - 12. 2008: Shibboleth 2.x and Single Logout support added&lt;br /&gt;
  - 1.  2008: Added logout hook and moved Shibboleth config strings to utf8 auth&lt;br /&gt;
              language files.&lt;br /&gt;
  - 3.  2009: Added various improvements and bug fixes reported by Ina M�ller from&lt;br /&gt;
              university Tuebingen and Peter Ellis of University of Washington&lt;br /&gt;
  - 4.  2009: Added another requirement for logout regarding the call back script&lt;br /&gt;
  - 6.  2009: Changed handler URL when integrated Discovery Service is used&lt;br /&gt;
  - 10. 2009: Fixed HTML entity preservation in Shibboleth settings&lt;br /&gt;
&lt;br /&gt;
  Moodle Configuration with Dual login&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
  1. Protect the directory moodle/auth/shibboleth/index.php with Shibboleth.&lt;br /&gt;
     The page index.php in that directory actually logs in a Shibboleth user.&lt;br /&gt;
     For Apache you have to define a rule like the following in the Apache config:&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory  /path/to/moodle/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
        AuthType shibboleth&lt;br /&gt;
        ShibRequireSession On&lt;br /&gt;
        require valid-user&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
  &lt;br /&gt;
     To restrict access to Moodle, replace the access rule &#039;require valid-user&#039;&lt;br /&gt;
     with something that fits your needs, e.g. &#039;require affiliation student&#039;.&lt;br /&gt;
  &lt;br /&gt;
     For IIS you have protect the auth/shibboleth directory directly in the&lt;br /&gt;
     RequestMap of the Shibboleth configuration file (shibboleth.xml or&lt;br /&gt;
     shibboleth2.xml).&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;moodle&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
     &amp;lt;Path name=&amp;quot;auth/shibboleth/index.php&amp;quot; requireSession=&amp;quot;true&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;AccessControl&amp;gt;&lt;br /&gt;
            ...&lt;br /&gt;
        &amp;lt;/AccessControl&amp;gt;&lt;br /&gt;
     &amp;lt;/Path&amp;gt;&lt;br /&gt;
  &amp;lt;/Path&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
   Also see:&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapper and&lt;br /&gt;
   https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAccessControl&lt;br /&gt;
&lt;br /&gt;
  2. As Moodle admin, go to the &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication&#039; and&lt;br /&gt;
     click on the the &#039;Shibboleth&#039; settings.&lt;br /&gt;
  &lt;br /&gt;
  3. Fill in the fields of the form. The fields &#039;Username&#039;, &#039;First name&#039;,&lt;br /&gt;
     &#039;Surname&#039;, etc. should contain the name of the environment variables of the&lt;br /&gt;
     Shibboleth attributes that you want to map onto the corresponding Moodle&lt;br /&gt;
     variable (e.g. &#039;Shib-Person-surname&#039; for the person&#039;s last name, refer&lt;br /&gt;
     the Shibboleth documentation or the documentation of your Shibboleth&lt;br /&gt;
     federation for information on which attributes are available).&lt;br /&gt;
     Especially the &#039;Username&#039; field is of great importance because&lt;br /&gt;
     this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
   #############################################################################&lt;br /&gt;
   Shibboleth Attributes needed by Moodle:&lt;br /&gt;
   For Moodle to work properly Shibboleth should at least provide the attribute&lt;br /&gt;
   that is used as username in Moodle. It has to be unique for all Shibboleth&lt;br /&gt;
   Be aware that Moodle converts the username to lowercase. So, the overall&lt;br /&gt;
   behaviour of the username will be case-insensitive.&lt;br /&gt;
   All attributes used for moodle must obey a certain length, otherwise Moodle&lt;br /&gt;
   cuts off the ends. Consult the Moodle documentation for further information&lt;br /&gt;
   on the maximum lengths for each field in the user profile.&lt;br /&gt;
   #############################################################################&lt;br /&gt;
&lt;br /&gt;
  4.a  If you want Shibboleth as your only authentication method with an external&lt;br /&gt;
     Where Are You From (WAYF) Service , set the &#039;Alternate Login URL&#039; in the&lt;br /&gt;
     &#039;Common settings&#039; in &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication Options&#039;&lt;br /&gt;
     to the the URL of the file &#039;moodle/auth/shibboleth/index.php&#039;.&lt;br /&gt;
     This will enforce Shibboleth login.&lt;br /&gt;
&lt;br /&gt;
  4.b If you want to use the Moodle integrated WAYF service, you have to activate it&lt;br /&gt;
    in the Moodle Shibboleth authentication settings by checking the&lt;br /&gt;
    &#039;Moodle WAYF Service&#039; checkbox and providing a list of entity IDs in the&lt;br /&gt;
    &#039;Identity Providers&#039; textarea together with a name and an optional&lt;br /&gt;
    SessionInitiator URL, which usually is an absolute or relative URL pointing&lt;br /&gt;
    to the same host. If no SessionInitiator URL is given, the default one&lt;br /&gt;
    &#039;/Shibboleth.sso&#039; (only works for Shibboleth 1.3.x) will be used. For&lt;br /&gt;
    Shibboleth 2.x you have to add &#039;/Shibboleth.sso/DS&#039; as a SessionInitiator.&lt;br /&gt;
    Also see https://wiki.shibboleth.net/confluence/display/SHIB/SessionInitiator&lt;br /&gt;
    and https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSessionInitiator&lt;br /&gt;
&lt;br /&gt;
    Important Note: If you upgraded from a previous version of Moodle and now&lt;br /&gt;
                    want to use the integrated WAYF, you have to make sure that&lt;br /&gt;
                    in step 1 only the index.php script in&lt;br /&gt;
                    moodle/auth/shibboleth/ is protected but *not* the other&lt;br /&gt;
                    scripts and especially not the login.php script.&lt;br /&gt;
&lt;br /&gt;
    If you were using the integrated WAYF alread with Shibboleth 1.3, it could&lt;br /&gt;
    be that the integrated WAYF is not working anymore after you updated Moodle.&lt;br /&gt;
    The reason is that the implicitly set default SessionInitiator changed in&lt;br /&gt;
    Moodle as well as in Shibboleth. For Shibboleth 1.3 one therefore has to&lt;br /&gt;
    add /Shibboleth.sso as third parameter whereas this is /Shibboleth.sso/DS&lt;br /&gt;
    for Shibboleth 2.x.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  5.  Save the changes for the &#039;Shibboleth settings&#039;.&lt;br /&gt;
&lt;br /&gt;
    Important Note: If you went for 4.b (integrated WAYF service), saving the&lt;br /&gt;
                    settings will overwrite the Moodle Alternate Login URL&lt;br /&gt;
                    using the Moodle web root URL.&lt;br /&gt;
&lt;br /&gt;
  6.  If you want to use Shibboleth in addition to another authentication method&lt;br /&gt;
    not using the integrated WAYF service from 4.b, change the &#039;Instructions&#039; in&lt;br /&gt;
    &#039;Administrations &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Manage authentication&#039; to contain a link to the&lt;br /&gt;
     moodle/auth/shibboleth/index.php file which is protected by&lt;br /&gt;
     Shibboleth (see step 1.) and causes the Shibboleth login procedure to start.&lt;br /&gt;
     You can also use HTML code in that field, e.g. to include an image as a&lt;br /&gt;
     Shibboleth login button.&lt;br /&gt;
&lt;br /&gt;
     Note: As of now you cannot use dual login together with the integrated&lt;br /&gt;
           WAYF service provided by Moodle (4.b).&lt;br /&gt;
&lt;br /&gt;
  7. Save the authentication changes.&lt;br /&gt;
&lt;br /&gt;
  How the Shibboleth authentication works&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  To get Shibboleth authenticated in Moodle a user basically must access the&lt;br /&gt;
  Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only&lt;br /&gt;
  authentication method (see 4.a), this happens automatically when a user selects&lt;br /&gt;
  his home organization in the Moodle WAYF service or if the alternate login URL&lt;br /&gt;
  is configured to be the protected /auth/shibboleth/index.php&lt;br /&gt;
  Otherwise, the user has to click on the link on the dual login page you&lt;br /&gt;
  provided in step 5.b.&lt;br /&gt;
&lt;br /&gt;
  Moodle basically checks whether the Shibboleth attribute that you mapped&lt;br /&gt;
  as the username is present. This attribute should only be present if a user is&lt;br /&gt;
  Shibboleth authenticated.&lt;br /&gt;
&lt;br /&gt;
  If the user&#039;s Moodle account has not existed yet, it gets automatically created.&lt;br /&gt;
&lt;br /&gt;
  To prevent that every Shibboleth user can access your Moodle site you have to&lt;br /&gt;
  adapt the &#039;require valid-user&#039; line in your webserver&#039;s config  (see step 1) to&lt;br /&gt;
  allow only specific users. If you defined some authorization rules in step 1,&lt;br /&gt;
  these are checked by Shibboleth itself. Only users who met these rules&lt;br /&gt;
  actually can access /auth/shibboleth/index.php and get logged in.&lt;br /&gt;
&lt;br /&gt;
  You can use Shibboleth AND another authentication method (it was tested with&lt;br /&gt;
  manual login). So, if there are a few users that don&#039;t have a Shibboleth&lt;br /&gt;
  login, you could create manual accounts for them and they could use the manual&lt;br /&gt;
  login. For other authentication methods you first have to configure them and&lt;br /&gt;
  then set Shibboleth as your authentication method. Users can log in only via one&lt;br /&gt;
  authentication method unless they have two accounts in Moodle.&lt;br /&gt;
  &lt;br /&gt;
  Shibboleth dual login with custom login page&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  You can create a dual login page that better fits your needs. For this&lt;br /&gt;
  to work, you have to set up the two authentication methods (e.g. &#039;Manual&lt;br /&gt;
  Accounts&#039; and &#039;Shibboleth&#039;) and specify an alternate login link to your own dual&lt;br /&gt;
  login page. On that page you basically need a link to the Shibboleth-protected&lt;br /&gt;
  page (&#039;/auth/shibboleth/index.php&#039;) for the Shibboleth login and a&lt;br /&gt;
  form that sends &#039;username&#039; and &#039;password&#039; to moodle/login/index.php. Set this&lt;br /&gt;
  web page then als alternate login page.&lt;br /&gt;
  Consult the Moodle documentation for further instructions and requirements.&lt;br /&gt;
  &lt;br /&gt;
  How to customize the way the Shibboleth user data is used in Moodle&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  Among the Shibboleth settings in Moodle there is a field that should contain a&lt;br /&gt;
  path to a php file that can be used as data manipulation hook.&lt;br /&gt;
  You can use this if you want to further process the way your Shibboleth&lt;br /&gt;
  attributes are used in Moodle. Due to security reasons this file cannot be&lt;br /&gt;
  located within the current site data directory ($CFG-&amp;gt;dataroot).&lt;br /&gt;
  &lt;br /&gt;
  Example 1: Your Shibboleth federation uses an attribute that specifies the&lt;br /&gt;
           user&#039;s preferred language, but the content of this attribute is not&lt;br /&gt;
           compatible with the Moodle data representation, e.g. the Shibboleth&lt;br /&gt;
           attribute contains &#039;German&#039; but Moodle needs a two letter value like&lt;br /&gt;
           &#039;de&#039;.&lt;br /&gt;
  Example 2: The country, city and street are provided in one Shibboleth attribute&lt;br /&gt;
           and you want these values to be used in the Moodle user profile. So&lt;br /&gt;
           You have to parse the corresponding attribute to fill the user fields.&lt;br /&gt;
&lt;br /&gt;
  If you want to use this hook you have to be a skilled PHP programmer. It is&lt;br /&gt;
  strongly recommended that you take a look at the file&lt;br /&gt;
  moodle/auth/shibboleth/auth.php, especially the function &#039;get_userinfo&#039;&lt;br /&gt;
  where this file is included.&lt;br /&gt;
  The context of the file is the same as within this login function. So you&lt;br /&gt;
  can directly edit the object $result.&lt;br /&gt;
&lt;br /&gt;
  Example file:&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
    // Set the zip code and the adress&lt;br /&gt;
    if ($_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address] != &#039;&#039;)&lt;br /&gt;
    {&lt;br /&gt;
        // $address contains something like &#039;SWITCH$Limmatquai 138$CH-8021 Zurich&#039;&lt;br /&gt;
        // We want to split this up to get:&lt;br /&gt;
        // institution, street, zipcode, city and country&lt;br /&gt;
        $address = $_SERVER[$this-&amp;gt;config-&amp;gt;field_map_address];&lt;br /&gt;
        list($institution, $street, $zip_city) = explode(&#039;$&#039;, $address);&lt;br /&gt;
        preg_match(&#039;/ (.+)/&#039;, $zip_city, $regs);&lt;br /&gt;
        $city = $regs[1];&lt;br /&gt;
&lt;br /&gt;
        preg_match(&#039;/(.+)-/&#039;,$zip_city, $regs);&lt;br /&gt;
        $country = $regs[1];&lt;br /&gt;
&lt;br /&gt;
        $result[&amp;quot;address&amp;quot;] = $street;&lt;br /&gt;
        $result[&amp;quot;city&amp;quot;] = $city;&lt;br /&gt;
        $result[&amp;quot;country&amp;quot;] = $country;&lt;br /&gt;
        $result[&amp;quot;department&amp;quot;] = $institution;&lt;br /&gt;
        $result[&amp;quot;description&amp;quot;] = &amp;quot;I am a Shibboleth user&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  How to upgrade your Service Provider to 2.x&lt;br /&gt;
  -------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
  In case your upgrade your Service Provider 1.3.x to 2.x, be aware of the fact&lt;br /&gt;
  that in version 2.0 the default behaviour regarding attribute propagation&lt;br /&gt;
  changed.&lt;br /&gt;
  While the Service Provider 1.3.x published the Shibboleth attributes to the&lt;br /&gt;
  web server environment as HTTP Request headers, the Service Provider 2.x&lt;br /&gt;
  publishes attributes as environment variables, which increases the security for&lt;br /&gt;
  some platforms.&lt;br /&gt;
  However, this change has the effect that the attribute names change.&lt;br /&gt;
  E.g. while the surname attribute was published as &#039;HTTP_SHIB_PERSON_SURNAME&#039;&lt;br /&gt;
  with 1.3.x, this attribute will be available in $_SERVER[&#039;Shib-Person-surname&#039;]&lt;br /&gt;
  or depending on your /etc/shibboleth/attribute-map.xml file just as&lt;br /&gt;
  $_SERVER[&#039;sn&#039;].&lt;br /&gt;
  Because Moodle needs to know what Shibboleth attributes it shall map onto which&lt;br /&gt;
  Moodle user profile field, one has to make sure the mapping is updated as well&lt;br /&gt;
  after the Service Provider upgrade.&lt;br /&gt;
  &lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
  Because you risk locking yourself out of Moodle it is strongly&lt;br /&gt;
  recommended to use the following approach when upgrading the Service Provider:&lt;br /&gt;
  1. Enable manual authentication before the upgrade.&lt;br /&gt;
  2. Make sure that you have at least one manual account with administration&lt;br /&gt;
     privileges working before upgrading your Service Provider to 2.x.&lt;br /&gt;
  3. After the SP upgrade, use this account to log into Moodle and adapt the&lt;br /&gt;
     attribute mapping in &#039;Site Administration -&amp;gt; Users -&amp;gt; Shibboleth&#039; to reflect&lt;br /&gt;
     the changed attribute names.&lt;br /&gt;
     You find the attribute names in the file /etc/shibboleth/attribute-map.xml&lt;br /&gt;
     listed as the &#039;id&#039; value of an attribute definition.&lt;br /&gt;
  4. If you are using the integrated WAYF, you may have to set the third parameter&lt;br /&gt;
     of each entry to &#039;/Shibboleth.sso/DS&#039;&lt;br /&gt;
  5. Test the login with a Shibboleth account&lt;br /&gt;
  6. If all is working, disable manual authentication again&lt;br /&gt;
  ********************************************************************************&lt;br /&gt;
&lt;br /&gt;
  How to add logout support&lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In order make Moodle support Shibboleth logout, one has to make the Shibboleth&lt;br /&gt;
  Service Provider (SP) aware of the Moodle logout capability. Only then the SP&lt;br /&gt;
  can trigger Moodle&#039;s front or back channel logout handler.&lt;br /&gt;
&lt;br /&gt;
  To make the SP aware of the Moodle logout, you have to add the following to the&lt;br /&gt;
  Shibboleth main configuration file shibboleth2.xml (usually in /etc/shibboleth/)&lt;br /&gt;
  just before the &amp;lt;MetadataProvider&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Notify&lt;br /&gt;
    Channel=&amp;quot;back&amp;quot;&lt;br /&gt;
    Location=&amp;quot;https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php&amp;quot; /&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
&lt;br /&gt;
  Then restart the Shibboleth daemon and check the log file for errors. If there&lt;br /&gt;
  were no errors, you can test the logout feature by accessing Moodle,&lt;br /&gt;
  authenticating via Shibboleth and the access the URL:&lt;br /&gt;
  #YOUR_MOODLE_HOSTNAME#/Shibboleth.sso/Logout (assuming you have a standard&lt;br /&gt;
  Shibboleth installation). If everything worked well, you should see a Shibboleth&lt;br /&gt;
  page saying that you were successfully logged out and if you go back to Moodle&lt;br /&gt;
  you also should be logged out from Moodle.&lt;br /&gt;
&lt;br /&gt;
  Requirements:&lt;br /&gt;
  - PHP needs the Soap Extension, which maybe must installed manually:&lt;br /&gt;
    More information is available here http://ch.php.net/soap&lt;br /&gt;
  - Logout only works with Shibboleth Service Provider 2.1 or higher&lt;br /&gt;
  - /moodle/auth/shibboleth/logout.php *must not* be protected by Shibboleth!&lt;br /&gt;
    In case all of Moodle is protected with Shibboleth, you have to add something&lt;br /&gt;
    like this to your Apache configuration after all the other require rules&lt;br /&gt;
  &lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Directory /path/to/moodle/auth/shibboleth/logout.php&amp;gt;&lt;br /&gt;
      AuthType shibboleth&lt;br /&gt;
      ShibRequireSession Off&lt;br /&gt;
      require shibboleth&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    When using IIS, the same can be achieved by something like:&lt;br /&gt;
  --&lt;br /&gt;
  &amp;lt;Path name=&amp;quot;auth/shibboleth/logout.php&amp;quot; requireSession=&amp;quot;false&amp;quot; &amp;gt;&lt;br /&gt;
  --&lt;br /&gt;
    in the shibboleth2.xml RequestMap.&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  Limitations:&lt;br /&gt;
  Single Logout is only supported when SAML2 is used at the SP and the IdP.&lt;br /&gt;
  As of October 2009, the Shibboleth Identity Provider 2.1.4 does not yet support&lt;br /&gt;
  Single Logout (SLO). Therefore, the single logout feature cannot be used yet&lt;br /&gt;
  in a Shibboleth only setup but there may be other SAML2 products that could&lt;br /&gt;
  be used as Identity Provider, e.g. SimpleSAML PHP.&lt;br /&gt;
  One of the reasons why SLO isn&#039;t supported yet is because there aren&#039;t many&lt;br /&gt;
  applications yet that were adapted to support front and back channel&lt;br /&gt;
  logout. Hopefully, the Moodle logout helps to motivate the developers to&lt;br /&gt;
  implement SLO. On the other hand, the easiest and safest way to log out&lt;br /&gt;
  still is to tell users to quit their web browsers :)&lt;br /&gt;
  &lt;br /&gt;
  Also see https://wiki.shibboleth.net/confluence/display/SHIB2/SLOIssues and&lt;br /&gt;
  https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLogoutInitiator for some&lt;br /&gt;
  background information on this topic.&lt;br /&gt;
  &lt;br /&gt;
  --------------------------------------------------------------------------------&lt;br /&gt;
  In case of problems and questions with Shibboleth authentication, contact&lt;br /&gt;
  Lukas Haemmerle &amp;lt;lukas.haemmerle@switch.ch&amp;gt; or Markus Hagman &amp;lt;hagman@hytti.uku.fi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE could be /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
    # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
    # systemctl start shibd&lt;br /&gt;
    # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
        &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                ServerName DOMAIN&lt;br /&gt;
                ServerAdmin YOU@DOMAIN&lt;br /&gt;
                DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
&lt;br /&gt;
                ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
                CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
        &lt;br /&gt;
                SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
                SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
                            # just comment out&lt;br /&gt;
                           # ShibRequestSetting applicationId mdl&lt;br /&gt;
                &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
                            AuthType shibboleth&lt;br /&gt;
                            # just comment out the next line and add the two lines below that&lt;br /&gt;
                            # ShibRequestSetting applicationId mdl&lt;br /&gt;
                            ShibRequireSession On&lt;br /&gt;
                            require valid-user&lt;br /&gt;
                &amp;lt;/Directory&amp;gt;&lt;br /&gt;
        &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Register the metadata with the federation&lt;br /&gt;
&lt;br /&gt;
Visit ​https://FEDERATTION/ and go to Join. You will be asked to upload the metadata on line and go through a couple of screens answering administrative questions. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
The fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto the corresponding Moodle variable. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===How to debug&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://shibboleth.internet2.edu Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;br /&gt;
[[es:Shibboleth]]&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149230</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149230"/>
		<updated>2024-09-03T13:46:19Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Added the section &amp;quot;A sample configuration&amp;quot;, an initial draft&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
{{Update}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on SAML. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. Identity providers (IdP&#039;s) supply user information, while service providers (SP&#039;s) consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
Source: [https://en.wikipedia.org/wiki/Shibboleth_(software) Wikipedia, Shibboleth_(software)]&lt;br /&gt;
&lt;br /&gt;
==Configuring Moodle to use Shibboleth==&lt;br /&gt;
&lt;br /&gt;
The auth/shibboleth/README.txt file in the in your Moodle distribution contains set-up instructions. Your web server might allow to view it in browser under YOURSITE/auth/shibboleth/README.txt.&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==A sample configuration==&lt;br /&gt;
&lt;br /&gt;
===Notation===&lt;br /&gt;
- The expressions in all caps are placeholders for their actual values. For example /PATH/TO/MOODLE could be /var/www/html/moodle in your server.&lt;br /&gt;
&lt;br /&gt;
- The &#039;#&#039; in shell commands in the form &#039;# COMMAND&amp;quot; means the COMMAND needs to be run as the super-user. It could be the user &#039;root&#039; or a different user having sudo privileges. In the latter case he should prepend the command with sudo, as in &#039;$ sudo COMMAND&#039;. The &#039;$&#039; in that command denotes it is a non-privileged user.&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
- You have your Moodle site running on Debian GNU/Linux or any of its derivatives like Ubuntu Linux.&lt;br /&gt;
&lt;br /&gt;
-  This  documentation assumes that your Linux distribution uses the system manager Systemd. But you can easily change the commands for a different init system, typically SysV or Upstart.&lt;br /&gt;
&lt;br /&gt;
- You are running the web server Apache2.&lt;br /&gt;
&lt;br /&gt;
- Your site serves HTTPS on its default port 443. We write its URL as https://DOMAIN, where DOMAIN stands for your the domain name of your Moodle server. So if the URL of your Moodle is https://lms.example.com/ then DOMAIN is lms.example.com.&lt;br /&gt;
&lt;br /&gt;
===Steps you have to follow===&lt;br /&gt;
1. Install the Shibboleth module for Apache2&lt;br /&gt;
&lt;br /&gt;
Install the Debian package libapache2-mod-shib, which contains the Apache module for Shibboleth service providers (SP) and its supporting Shib daemon:&lt;br /&gt;
&lt;br /&gt;
    # apt install libapache2-mod-shib --no-install-recommends&lt;br /&gt;
&lt;br /&gt;
It will create a directory /etc/shibboleth with a default set of configuration files and also install the system service shib.&lt;br /&gt;
&lt;br /&gt;
2. Download federation metadata signing certificate&lt;br /&gt;
&lt;br /&gt;
    # wget https://FEDERATIONREGISTRY/signedmetadata/metadata-signer -O /etc/shibboleth/federation-cert.pem&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Configure the Shibboleth service provider&lt;br /&gt;
&lt;br /&gt;
Edit the /etc/shibboleth/shibboleth2.xml file as described below.&lt;br /&gt;
&lt;br /&gt;
3.1 Change the ApplicationDefaults tag to your domain&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;ApplicationDefaults entityID=&amp;quot;https://DOMAIN/shibboleth&amp;quot;&lt;br /&gt;
        REMOTE_USER=&amp;quot;eppn subject-id pairwise-id persistent-id&amp;quot;&lt;br /&gt;
        cipherSuites=&amp;quot;DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the end of the ApplicationDefaults tag is way below. So don&#039;t add one here!&lt;br /&gt;
&lt;br /&gt;
3.2 Set the discovery server&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;SSO  discoveryProtocol=&amp;quot;SAMLDS&amp;quot; discoveryURL=&amp;quot;https://DISCOVERYSERVER&amp;quot;&amp;gt;&lt;br /&gt;
              SAML2&lt;br /&gt;
            &amp;lt;/SSO&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.3 Set the MetadataProvider&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;MetadataProvider type=&amp;quot;XML&amp;quot; url=&amp;quot;https://METADATAPROVIDER/signedmetadata/metadata.xml&amp;quot; legacyOrgName=&amp;quot;true&amp;quot; backingFilePath=&amp;quot;test-metadata.xml&amp;quot; maxRefreshDelay=&amp;quot;7200&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;Signature&amp;quot; certificate=&amp;quot;federation-cert.pem&amp;quot; verifyBackup=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;MetadataFilter type=&amp;quot;RequireValidUntil&amp;quot; maxValidityInterval=&amp;quot;864000&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/MetadataProvider&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.4 Set the names of the key and certificate files&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;lms-signing-key.pem&amp;quot; certificate=&amp;quot;lms-signing-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot; key=&amp;quot;lms-encrypt-key.pem&amp;quot; certificate=&amp;quot;lms-encrypt-cert.pem&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will generate those lms-*.pem files in step 3.6.&lt;br /&gt;
&lt;br /&gt;
3.5 Add a ApplicationOverride section&lt;br /&gt;
(Note: Not necessay, dg 28 Aug 2024)&lt;br /&gt;
&lt;br /&gt;
Add the following ApplicationOverride section just before the ApplicationDefaults section:&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;ApplicationOverride id=&amp;quot;wp&amp;quot; entityID=&amp;quot;https://wp.YOUR-DOMAIN/shibboleth&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;signing&amp;quot;  key=&amp;quot;wp-signing-key.pem&amp;quot; certificate=&amp;quot;wp-signing-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
                &amp;lt;CredentialResolver type=&amp;quot;File&amp;quot; use=&amp;quot;encryption&amp;quot;  key=&amp;quot;wp-encrypt-key.pem&amp;quot; certificate=&amp;quot;wp-encrypt-cert.pem&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/ApplicationOverride&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.6 Create SP metadata credentials for both sites:&lt;br /&gt;
&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-signing -e https://DOMAIN/shibboleth&lt;br /&gt;
    /usr/sbin/shib-keygen -n lms-encrypt -e https://DOMAIN/shibboleth&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Start the shibboleth service&lt;br /&gt;
&lt;br /&gt;
4.1 Test the configuration first:&lt;br /&gt;
&lt;br /&gt;
    # shibd -t /etc/shibboleth/shibboleth2.xml&lt;br /&gt;
&lt;br /&gt;
4.2 (Re)start the Shibd and Apache2:&lt;br /&gt;
&lt;br /&gt;
    # systemctl start shibd&lt;br /&gt;
    # systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Enable Shibboleth on the Apache virtual host&lt;br /&gt;
&lt;br /&gt;
5.1 To enable shibboleth login on the web application add the certificate files and protect the /PATH/TO/MOODLE/auth/shibboleth/index.php by Shibboleth. They are in a /etc/apache2/sites-available/SOMETHING.conf file. Here is the format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
        &amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                ServerName DOMAIN&lt;br /&gt;
                ServerAdmin YOU@DOMAIN&lt;br /&gt;
                DocumentRoot /PATH/TO/MOODLE&lt;br /&gt;
&lt;br /&gt;
                ErrorLog ${APACHE_LOG_DIR}/DOMAIN-error.log&lt;br /&gt;
                CustomLog ${APACHE_LOG_DIR}/DOMAIN-access.log combined&lt;br /&gt;
        &lt;br /&gt;
                SSLCertificateFile /etc/ssl/certs/ssl-DOMAIN.crt&lt;br /&gt;
                SSLCertificateKeyFile /etc/ssl/private/ssl-DOMAIN.key&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Location /moodle&amp;gt;&lt;br /&gt;
                            # just comment out&lt;br /&gt;
                           # ShibRequestSetting applicationId mdl&lt;br /&gt;
                &amp;lt;/Location&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Directory /PATH/TO/MOODLE/auth/shibboleth/index.php&amp;gt;&lt;br /&gt;
                            AuthType shibboleth&lt;br /&gt;
                            # just comment out the next line and add the two lines below that&lt;br /&gt;
                            # ShibRequestSetting applicationId mdl&lt;br /&gt;
                            ShibRequireSession On&lt;br /&gt;
                            require valid-user&lt;br /&gt;
                &amp;lt;/Directory&amp;gt;&lt;br /&gt;
        &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.2 Activate Shibd and reload Apache&lt;br /&gt;
&lt;br /&gt;
    # a2enmod shib&lt;br /&gt;
    # systemctl reload apache2.service &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Register the SP with the federation&lt;br /&gt;
&lt;br /&gt;
We have now set up Shibboleth SP for Moodle. It has to be registered with the federation so that its WAYF go to the discovery Service to point different IDP&#039;s.&lt;br /&gt;
&lt;br /&gt;
6.1 Download the metadata of the application&lt;br /&gt;
&lt;br /&gt;
You can get them by visiting the URL https://DOMAIN/Shibboleth.sso/Metadata &lt;br /&gt;
&lt;br /&gt;
6.2 Register the metadata with the federation&lt;br /&gt;
&lt;br /&gt;
Visit ​https://FEDERATTION/ and go to Join. You will be asked to upload the metadata on line and go through a couple of screens answering administrative questions. Follow the instructions on the screens.&lt;br /&gt;
&lt;br /&gt;
Once the federation operator approves your request you will receive a SP registration link.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Enable and configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve registered successfully you have to configure the Shibboleth plug-in in Moodle. For that Moodle you have to enable it first.&lt;br /&gt;
&lt;br /&gt;
7.1 Enable the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
As Moodle admin, go to the Site administration &amp;gt; Plugins &amp;gt; Authentication and enable Shibboleth by clicking on the &amp;quot;eye&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
7.2 Configure the Shibboleth plug-in in Moodle&lt;br /&gt;
&lt;br /&gt;
The fields &#039;Username&#039;, &#039;First name&#039;, &#039;Surname&#039;, etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto the corresponding Moodle variable. Especially the &#039;Username&#039; field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users.&lt;br /&gt;
&lt;br /&gt;
Username: eppn&lt;br /&gt;
&lt;br /&gt;
Moodle WAYF service: No&lt;br /&gt;
&lt;br /&gt;
Identity providers (auth_shibboleth | organization_selection): Delete everything in the box&lt;br /&gt;
&lt;br /&gt;
Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout&lt;br /&gt;
&lt;br /&gt;
Data mapping (First name): givenName&lt;br /&gt;
&lt;br /&gt;
Data mapping (Surname): sn&lt;br /&gt;
&lt;br /&gt;
Data mapping (Email address): mail&lt;br /&gt;
&lt;br /&gt;
In all three set Update local to On every login and Lock value to Unlocked if empty.&lt;br /&gt;
&lt;br /&gt;
And save. The change will be immediately active, no need to restart any service!&lt;br /&gt;
&lt;br /&gt;
===Finished!===&lt;br /&gt;
Now you may browse to ​https://DOMAIN/ and select your preferred IdP to log in.&lt;br /&gt;
&lt;br /&gt;
===How to debug&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://shibboleth.internet2.edu Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149198</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149198"/>
		<updated>2024-08-24T22:21:35Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
{{Update}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Shibboleth is a middleware architecture and an open-source implementation created by the [https://en.wikipedia.org/wiki/Internet2 Internet2] consortium, for federated identity-based authentication and authorization infrastructure based on SAML. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. Identity providers (IdP&#039;s) supply user information, while service providers (SP&#039;s) consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
Source: [https://en.wikipedia.org/wiki/Shibboleth_(software) Wikipedia, Shibboleth_(software)]&lt;br /&gt;
&lt;br /&gt;
==Configuring Moodle to use Shibboleth==&lt;br /&gt;
&lt;br /&gt;
The auth/shibboleth/README.txt file in the in your Moodle distribution contains set-up instructions. Your web server might allow to view it in browser under YOURSITE/auth/shibboleth/README.txt.&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://shibboleth.internet2.edu Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149197</id>
		<title>Shibboleth</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Shibboleth&amp;diff=149197"/>
		<updated>2024-08-24T22:12:34Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
{{Update}}&lt;br /&gt;
Location: Settings link in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; Manage authentication&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Shibboleth is an Internet2 Middleware Initiative project that has created an architecture and open-source implementation for federated identity-based authentication and authorization infrastructure based on SAML. Federated identity allows for information about users in one security domain to be provided to other organizations in a common federation. This allows for cross-domain single sign-on and removes the need for content providers to maintain usernames and passwords. Identity providers (IdP&#039;s) supply user information, while service providers (SP&#039;s) consume this information and gate access to secure content.&lt;br /&gt;
&lt;br /&gt;
Source: [https://en.wikipedia.org/wiki/Shibboleth_(software) Wikipedia, Shibboleth_(software)]&lt;br /&gt;
&lt;br /&gt;
==Configuring Moodle to use Shibboleth==&lt;br /&gt;
&lt;br /&gt;
The auth/shibboleth/README.txt file in the in your Moodle distribution contains set-up instructions. Your web server might allow to view it in browser under YOURSITE/auth/shibboleth/README.txt.&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in the UK==&lt;br /&gt;
In the UK Becta and JISC have implemented an education federation using Shibboleth to provide single sign on. This means that education establishments in the UK using Moodle should be able to authenticate their users via Shibboleth if their organization joins the UK Access Management Federation and their users&#039; identity is held by the identity provider the LA/RBC use. For maintained schools in the England and Wales this will probably mean contacting their Local Authority or Regional Broadband Consortium (RBC). A list of current UK federation members can be found [http://www.ukfederation.org.uk/content/Documents/MemberList here].&lt;br /&gt;
&lt;br /&gt;
==Shibboleth in Switzerland ==&lt;br /&gt;
In Switzerland the [https://switch.ch/ SWITCH Foundation] runs a universal login under [https://www.switch.ch/edu-id edu-ID] for all living in Switzerland. It covers 160 institutions and 900,000 users.&lt;br /&gt;
&lt;br /&gt;
==Additional notes==&lt;br /&gt;
Some IdPs will only share a minimal set of user fields with your Moodle SP, which can cause problems:&lt;br /&gt;
*Moodle errors relating to missing Shibboleth fields can be fixed by altering the data mappings within the Shibboleth authentication plugin, and ensuring that fields are not locked. The user will be asked to manually provide data if Shibboleth does not automatically provide the corresponding information.&lt;br /&gt;
*Moodle errors relating to invalid characters in username can be fixed by Allowing extended characters in usernames (found under Security &amp;gt; Site policies).&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://shibboleth.internet2.edu Shibboleth Internet2 Website]&lt;br /&gt;
*[http://www.ukfederation.org.uk/ UK Access Management Federation for Education and Research]&lt;br /&gt;
*[http://www.ukfederation.org.uk/content/Documents/AttributeUsage Current Core Attributes for the UK Federation]&lt;br /&gt;
&lt;br /&gt;
[[fr:Shibboleth]]&lt;br /&gt;
[[ja:Shibboleth]]&lt;br /&gt;
[[de:Shibboleth-Server]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Effective_quiz_practices&amp;diff=145782</id>
		<title>Effective quiz practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Effective_quiz_practices&amp;diff=145782"/>
		<updated>2023-03-30T00:41:46Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz}}&lt;br /&gt;
As we’ve seen, Moodle quiz engine is a powerful, flexible tool for monitoring and diagnosing student performance with certain types of knowledge. Using this tool effectively can boost your course&#039;s effectiveness, and promote student performance. While a computer-scored quiz is a different performance than more open-ended assessments, it does give a valuable window onto student thinking, especially when you use good strategies, and a little creativity.&lt;br /&gt;
&lt;br /&gt;
==Quiz strategies==&lt;br /&gt;
Of course, using the quiz engine effectively takes some work and practice. The first thing to do is to use effective question design strategies. If you ask good questions, you&#039;ll get useful data about your students’ performance and understanding of the material. Of course, the converse is also true. There is a ton of literature about effective assessment design available. I&#039;ll just highlight a few of the most important ideas.&lt;br /&gt;
*Tie each question to a course goal. After all, you want to know whether your students are achieving the goals of the course, so why not ask them directly?&lt;br /&gt;
*Try to ask multiple questions about each important idea in the class. This gives you more data points about student understanding.&lt;br /&gt;
*When writing a multiple-choice question, be sure each wrong answer represents a common mis-conception. This will help you diagnose student thinking and eliminate easy guessing. &lt;br /&gt;
*Write questions requiring your students to think at different levels. Include some recall questions, some comprehension questions and some application and analysis questions. You can determine where students are having problems in their thinking. Can they recall the material, but not apply it?&lt;br /&gt;
*Test your questions. After you&#039;ve established an initial question bank, use the system reports to determine which questions are useful, and which aren&#039;t. As you write new questions, give them a lower point value and throw in a few to establish their reliability.&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve got a few well-written test banks, be sure to use the [[quiz reports]] and statistics to monitor your classes performance. The detailed reports and statistics available to you are valuable tools for understanding student understanding of the material.&lt;br /&gt;
&lt;br /&gt;
==Creative quiz uses==&lt;br /&gt;
With the Moodle quiz engine, it&#039;s easier to utilize educationally sound assessment strategies which would be too difficult to implement with paper and pencil. &lt;br /&gt;
&lt;br /&gt;
===Formative assessment and summative assessment===&lt;br /&gt;
Most people think of tests as an infrequent, high-stakes activity, like mid-terms and finals ([https://en.wikipedia.org/wiki/Summative_assessment summative assessment]). Better strategies involve frequent, low-stakes ([https://en.wikipedia.org/wiki/Formative_assessment formative assessments]) that you and your students can use to guide their performance during the course of the semester. &lt;br /&gt;
&lt;br /&gt;
Creating a series of small mini-tests gives you a very flexible system for gauging performance and keeping students engaged in the class. Here are a few ideas for quick quizzes you can use as part of a larger assessment strategy.&lt;br /&gt;
&lt;br /&gt;
===Chapter checks===&lt;br /&gt;
Getting students to complete reading assignments has to be one of the hardest motivational tasks in education. Reading is critical to understanding most material, and fundamental to success in many classes. The problem for most students is there is no immediate reward or punishment for procrastinating on a reading assignment. If you haven&#039;t done the reading for a class discussion, you can either keep quiet, or, as I used to do occasionally, wing it by skimming in class. If you have a lecture course, there&#039;s almost no need to do the reading as the lecturer usually covers most of the material in class anyway. &lt;br /&gt;
&lt;br /&gt;
Creating a little mini-test for each reading assignment solves a number of problems. First, it encourages students to do the reading so they can do well on the quiz. Second, it gives the students feedback on how well they understood the reading assignment. Third, it gives you data about what aspects of the reading students found confusing, and which they have already mastered so you can focus your class activities.&lt;br /&gt;
&lt;br /&gt;
For a reading mini-test, I would recommend setting a limited time quiz students can only take once. Because it&#039;s a low-stakes activity you want students to use for self-assessment, I would also display feedback and correct answers. If you&#039;re concerned about students sharing answers after they&#039;ve taken the quiz, randomize the question and answer order. If you have a test bank, make some of the questions random as well. As an additional assignment, students should write down one question about a question they got wrong, and bring it to class.&lt;br /&gt;
&lt;br /&gt;
===Test practice===&lt;br /&gt;
The key to effective practice is to have a realistic practice environment. Many students worry about tests, especially high-stakes tests, because they have no idea what to expect. What question format will you use? How detailed will the questions be? What should they study?&lt;br /&gt;
&lt;br /&gt;
You can help alleviate test anxiety by creating a practice test students can take to help answer these questions. These tests are usually based on old questions similar to the current test questions. Use last year&#039;s final as an example test, which will force you into the practice of writing new questions every year. This is a good idea anyway, as you can be sure someone has a copy of last year&#039;s test they are sharing with others.&lt;br /&gt;
&lt;br /&gt;
To set up a practice test, I&#039;d create a zero point test with questions from the year before in random order with random answers. I would also allow students to take the test as many times as they’d like so they can test themselves as much as they need. Display feedback, but not correct answers so it presents more of a challenge.&lt;br /&gt;
&lt;br /&gt;
[[Gamification]] may be used for quiz practice. See the [[Quizventure activity]].&lt;br /&gt;
&lt;br /&gt;
===Data gathering===&lt;br /&gt;
&lt;br /&gt;
As an expert, you know a lot about your field. Your challenge as a teacher is to translate your knowledge for a novice who doesn&#039;t share your conceptual structure or experience. An example or lecture you think is brilliant may leave your students completely confused. It can be hard to tell what students really understand and what&#039;s leaving them baffled.&lt;br /&gt;
&lt;br /&gt;
A data-gathering quiz is similar to a chapter check, but it takes place after a class meeting or lecture. Your goal is to quickly get some feedback on student understanding of a lecture. What did they really understand? What do you need to spend more time on? I’ve found many instructors have trouble gauging what students find difficult, and what the students find so easy they are bored. &lt;br /&gt;
&lt;br /&gt;
Setting up a post-class data-gathering quiz is similar to creating a chapter check. Set the quiz for a limited time, like a day or two before the next meeting. Allow them to take it once and display feedback and correct answers. &lt;br /&gt;
&lt;br /&gt;
==Quiz security and cheating==&lt;br /&gt;
&lt;br /&gt;
Of course, online testing also presents another chance for the cheaters in your classes to try to game the system. Most online quizzes are meant to be taken at home, or at least outside of class. Students can download the questions and print them out. They can take the tests with other students, or while reading their textbooks.&lt;br /&gt;
&lt;br /&gt;
Fortunately, you can counter many of these strategies, making them more trouble than they are worth to the students. Let&#039;s look at a few strategies for countering most cheating schemes&lt;br /&gt;
&lt;br /&gt;
===Printing and sharing questions===&lt;br /&gt;
If you display feedback and correct answers, students can print the results page and share it with their friends. Or they can simply print the questions themselves directly from the quiz. The key to discouraging this behavior is to randomize the question order and the answer order. It makes the printouts a lot less useful. Creating larger question banks and giving tests with random subsets is also an effective strategy. If students can only print a small number of questions at a time, they will need to view the test again and again, then sort the questions to eliminate duplicates. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Warning: Assume there will be printed copies of your questions available to students who want them. Most instructors don’t realize students frequently have copies of old paper based tests, and electronic test delivery is another way for students to get copies of the questions. I know one professor who had over 1100 questions in his online test bank. At the end of the semester, he confiscated a printout from a student. It had every question with the correct answer, neatly formatted and divided by textbook chapter. We decided if students wanted to memorize 1100 questions and answers to the level where they could answer a small number of them displayed at random, then they would have learned more than if they had just studied. Of course, we used timed quizzes and other strategies to minimize using the print-out as a reference manual.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you activate the &#039;&#039;&#039;[[Safe Exam Browser]]&#039;&#039;&#039; settings and allow students only to take the quiz with this open-source lock-down browser, students cannot download or print the questions at all. But this setting add the hurdles that students have to install an additional (open-source) software on their devices.&lt;br /&gt;
&lt;br /&gt;
===Using the textbook===&lt;br /&gt;
Students will frequently look up the answer to questions in the textbook or a reading. If you are giving a chapter check quiz, then this is what you want them to do. Otherwise, you need to come up with creative ways of making the textbook less directly useful. Timed quizzes are the single most effective tool for eliminating this strategy. A timed quiz requires the students answer the questions in a certain amount of time. If you give enough questions and make the time short enough, they won&#039;t have time to look up all the answers. I usually give about 30 seconds per multiple-choice question. If they answer them faster and have time to look up some answers afterward, I figure they knew enough to deserve to look up an answer or two.&lt;br /&gt;
&lt;br /&gt;
Asking students to apply their knowledge to novel situation can also make a difference. Synthesis and application questions can&#039;t be looked up. Students have to understand the material and apply it creatively to answer the questions. So while they may take the time to review the text, they will still need to try to understand what they&#039;ve read to successfully answer the question.&lt;br /&gt;
&lt;br /&gt;
===Working with friends===&lt;br /&gt;
If your students are on the same campus, they may get together in a lab and try to take the quiz together. This is an easy strategy to thwart with random question order, random answer order and questions randomly pulled from a test bank. If my screen doesn&#039;t look like yours, then it&#039;s harder for us to quickly answer all of the questions. A timed quiz also makes it harder for the two of us to cheat if we have different questions and we only have a short amount of time to answer.&lt;br /&gt;
&lt;br /&gt;
===Have someone else take the test===&lt;br /&gt;
The old adage goes “On the Internet, no one knows you’re a dog”, and no one knows who is actually taking the test. Students will sometimes pay classmates, or others who have taken the course in the past, to take online quizzes for them. There are two ways to counter this strategy. One, have an occasional proctored exam where students need to show ID. If they haven&#039;t taken the quizzes or done the work until then, they will do poorly on the proctored exam. To eliminate current classmates from taking each other&#039;s quizzes, only make them available for a short time. You could require everyone take the test within a 2- or 4-hour block. If the test is properly randomized, it will be very difficult to take it more than once during the testing period. The test taker will worry about their own grade first, then about their employer&#039;s grade.&lt;br /&gt;
&lt;br /&gt;
Obviously, there are many strategies students can use to cheat. While it would be naïve to assume there isn&#039;t cheating, the vast majority of your students want to succeed on their own merits. The anonymity of the online environment may open up new avenues for the cheaters, but it&#039;s not really much different from your face-to-face classes. A few people will go to great lengths to cheat, but most will be honest as long as it&#039;s not too easy to get away with it. A few precautions will eliminate most of the easy cheats, and the classic strategies will work for the others.&lt;br /&gt;
&lt;br /&gt;
==Robust testing with random variants==&lt;br /&gt;
&lt;br /&gt;
This section describes a good way to help minimise the potential for cheating, and increase the opportunity for students to learn from the feedback by repeated attempts at the quiz. The basic idea is to take each particular question that you were thinking of, and make several slight variants of it. Then use Moodle&#039;s random question feature, so that each student gets one of the variants picked at random.&lt;br /&gt;
&lt;br /&gt;
===An example===&lt;br /&gt;
&lt;br /&gt;
A good example of this (although not in Moodle) can be seen at https://students.open.ac.uk/openmark/mu120.m5omdemo/. Take that test once, making a rough note of the questions you are asked. Then after you have done &#039;End test&#039;, do &#039;Restart entire test&#039; and see that you are asked a different set of questions that have different answers, although they test the same knowledge. This sort of strategy is easier to implement in some subjects than in others.&lt;br /&gt;
&lt;br /&gt;
===How to set this up in Moodle===&lt;br /&gt;
&lt;br /&gt;
Suppose we are going to create a quiz with 6 questions about interpreting diagrams (that is, we are going to try to clone the OpenMark example above). For the fourth question, the closest we will be able to get would be [https://moodle.org/plugins/qtype_ddmarker the Image target question type from the Modules and plugins database].&lt;br /&gt;
&lt;br /&gt;
====1. Create a category for each &#039;question&#039; in the quiz====&lt;br /&gt;
&lt;br /&gt;
As you can see from the screen shot, I have created six appropriately named categories, all neatly grouped inside a parent category. You do this on the &#039;Categories&#039; tab of the question bank interface.&lt;br /&gt;
&lt;br /&gt;
[[Image:Variants_categories.png]]&lt;br /&gt;
&lt;br /&gt;
====2. Create the first variant of the first question====&lt;br /&gt;
&lt;br /&gt;
Create the first variant of the first question, just like you would create any other Moodle question.&lt;br /&gt;
&lt;br /&gt;
In our example, this might be an Embedded answers (Cloze) question type. The question text might be:&lt;br /&gt;
&lt;br /&gt;
:Below is a plan of a proposed garden. The scale is that each division in the plan represents a length in the garden of 0.5 metres. What is the proposed length and width of the Patio in the garden?      &lt;br /&gt;
: [[Image:Variants_flowerbed.gif]]&lt;br /&gt;
: The Patio is {&#039;&#039;CLOZE syntax&#039;&#039;} metres by {&#039;&#039;CLOZE syntax&#039;&#039;} metres.&lt;br /&gt;
&lt;br /&gt;
====3. Create the other variants of the first question====&lt;br /&gt;
&lt;br /&gt;
To easily create a variant, click the duplicate icon next to the first question, then make the changes you need to turn it into the second variant and save it. Repeat this process to create as many variants as you want. &lt;br /&gt;
&lt;br /&gt;
In our example, we might change the word Patio, and the scale factor each division represents 0.5 metres. We would also need to change the answers and the associated feedback in the {&#039;&#039;CLOZE syntax&#039;&#039;} bits.&lt;br /&gt;
&lt;br /&gt;
====4. Repeat 2. and 3. for the other questions====&lt;br /&gt;
&lt;br /&gt;
The screen shots show the variants of the third question. This one is a bit more of a pain to set up, because each variant will use a different image of a pie chart, so there is a bit more editing to do, and more files to upload to the course files area.&lt;br /&gt;
&lt;br /&gt;
[[Image:Variants_questionsincat.png]]&lt;br /&gt;
&lt;br /&gt;
====5. Add the questions to the quiz====&lt;br /&gt;
&lt;br /&gt;
Once you have created all the questions, add them to the quiz using the &#039;Add random question&#039; feature. Select the first category (Reading a plan variants). Ensure &#039;Display questions from sub-categories too&#039; is off. Use the controls at the bottom to Add 1 random question to the quiz.&lt;br /&gt;
&lt;br /&gt;
Repeat for each of the other categories in order.&lt;br /&gt;
&lt;br /&gt;
[[Image:Variants_quiz.png]]&lt;br /&gt;
&lt;br /&gt;
===Creating variant questions in Atto===&lt;br /&gt;
In 2016, a new additional plugin, the [[Cloze editor for Atto]] has a &#039;Duplicate&#039; button, that allows you to easily and quickly create many question variants.&lt;br /&gt;
&lt;br /&gt;
===Comments===&lt;br /&gt;
&lt;br /&gt;
Obviously this is more work to set up (although not three times as much work as creating one quiz). It is up to you to do the cost benefit analysis for your particular quiz. Note that once you have set this up, you are more likely to be able to reuse quizzes in future, because you have reduced the potential for simple copying of answers.&lt;br /&gt;
&lt;br /&gt;
As an alternative to &#039;Save as new question&#039;, you can use Moodle&#039;s import and export formats, and copy and paste in your text editor to create variants.&lt;br /&gt;
&lt;br /&gt;
One issue you have to worry about is, are all the variants you have made of each question really equally difficult? Moodle 2.0 will feature a new Statistics report which should help you analyse your quiz results to see how difficult each variant is.&lt;br /&gt;
&lt;br /&gt;
Experience shows that &#039;a few variants&#039; can normally be taken to be 3 variants. This is enough to ensure that two students working at neighbouring computers will mostly get different questions to each other. More is better (providing you can ensure equal difficulty) but is more work, so you get diminishing returns.&lt;br /&gt;
&lt;br /&gt;
(This section expands some of the advice above under [[#Printing and sharing questions|Printing and sharing questions]]. It also describes how most online assessments at the Open University are constructed. The [[calculated question type]] is sometimes another way to implement quizzes like this.)&lt;br /&gt;
&lt;br /&gt;
==Certainty Based Marking==&lt;br /&gt;
* To make students think about how reliable their answer is.&lt;br /&gt;
* To encourage students to try to understand the issues, not just react immediately to a question.&lt;br /&gt;
* To challenge: if a student won&#039;t risk losing marks if wrong then they don&#039;t really know the answer.&lt;br /&gt;
* If a student is a careful thinker but not very confident. they will gain in confidence.&lt;br /&gt;
* It is more fair - a thoughtful and confident correct answer deserves more marks than a lucky hunch.&lt;br /&gt;
* Students need to pay attention if they make confident wrong answers: think, reflect, learn!&lt;br /&gt;
* Efficient study requires constantly questioning how our ideas arise and how reliable they are.&lt;br /&gt;
&lt;br /&gt;
See [[Using certainty-based marking]].&lt;br /&gt;
&lt;br /&gt;
==Proctored exams==&lt;br /&gt;
* As a start, check the info in this discussion: https://moodle.org/mod/forum/discuss.php?d=399255#p1610674. Use advance search for the forums, as there has been a bunch of discussion in 2020 about this subject.&lt;br /&gt;
&lt;br /&gt;
* One of the better solutions seen recently for lockdown testing, was a combination of things:&lt;br /&gt;
**Use of the safe browser and have the proctor call the student via some form of video call. &lt;br /&gt;
**Have the student show the proctor their computer setup and the room the test will be taken in. &lt;br /&gt;
**Then, have the student set up the phone in a position showing the student and their computer screen, as best they can from across the room. &lt;br /&gt;
**This allows the proctor to watch and hopefully, see any attempts to cheat.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Safe exam browser]] The Safe Exam Browser can work with Moodle to control what a student can do when in Moodle. To use it, it must be enabled the [[Quiz settings]]. This adds some additional options which could be chosen directly in the quiz settings. &lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=399255#p1610674  Implementing remotely invigilated online exams at scale] - The key lessons and successes of the University of New England&#039;s experience in implementing large scale remotely invigilated (proctored) online exams&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=141003 How do you keep people from cheating while taking a quiz?]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=271100#p1168345 User dependent locking and unlocking of quizzes]&lt;br /&gt;
&lt;br /&gt;
External links:&lt;br /&gt;
* [https://www.openlms.net/blog/products/30-tips-for-creating-quiz-questions-lms/ 30 tips for creating quiz questions] by Rebecca DeSantis, MSIT, Moodlerooms Instructional Designer&lt;br /&gt;
* [https://www.alfiekohn.org/article/whos-cheating/ Who is Cheating Whom] article&lt;br /&gt;
* [https://www.ohsu.edu/sites/default/files/2019-03/Teacher%20section%20NBME%20Constructing%20Written%20Test%20questions%20for%20the%20basic%20and%20clinical%20sciences.pdf Constructing written test questions for the basic and clinical sciences] - by the National Board of Medical Examiners (USA)&lt;br /&gt;
&lt;br /&gt;
[[es:Prácticas Eficaces en los Exámenes]]&lt;br /&gt;
[[de:Tests effektiv durchführen]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Effective_quiz_practices&amp;diff=145781</id>
		<title>Effective quiz practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Effective_quiz_practices&amp;diff=145781"/>
		<updated>2023-03-30T00:30:39Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz}}&lt;br /&gt;
As we’ve seen, Moodle quiz engine is a powerful, flexible tool for monitoring and diagnosing student performance with certain types of knowledge. Using this tool effectively can boost your course&#039;s effectiveness, and promote student performance. While a computer-scored quiz is a different performance than more open-ended assessments, it does give a valuable window onto student thinking, especially when you use good strategies, and a little creativity.&lt;br /&gt;
&lt;br /&gt;
==Quiz strategies==&lt;br /&gt;
Of course, using the quiz engine effectively takes some work and practice. The first thing to do is to use effective question design strategies. If you ask good questions, you&#039;ll get useful data about your students’ performance and understanding of the material. Of course, the converse is also true. There is a ton of literature about effective assessment design available. I&#039;ll just highlight a few of the most important ideas.&lt;br /&gt;
*Tie each question to a course goal. After all, you want to know whether your students are achieving the goals of the course, so why not ask them directly?&lt;br /&gt;
*Try to ask multiple questions about each important idea in the class. This gives you more data points about student understanding.&lt;br /&gt;
*When writing a multiple-choice question, be sure each wrong answer represents a common mis-conception. This will help you diagnose student thinking and eliminate easy guessing. &lt;br /&gt;
*Write questions requiring your students to think at different levels. Include some recall questions, some comprehension questions and some application and analysis questions. You can determine where students are having problems in their thinking. Can they recall the material, but not apply it?&lt;br /&gt;
*Test your questions. After you&#039;ve established an initial question bank, use the system reports to determine which questions are useful, and which aren&#039;t. As you write new questions, give them a lower point value and throw in a few to establish their reliability.&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve got a few well-written test banks, be sure to use the [[quiz reports]] and statistics to monitor your classes performance. The detailed reports and statistics available to you are valuable tools for understanding student understanding of the material.&lt;br /&gt;
&lt;br /&gt;
==Creative quiz uses==&lt;br /&gt;
With the Moodle quiz engine, it&#039;s easier to utilize educationally sound assessment strategies which would be too difficult to implement with paper and pencil. &lt;br /&gt;
&lt;br /&gt;
===Formative assessment and summative assessment===&lt;br /&gt;
Most people think of tests as an infrequent, high-stakes activity, like mid-terms and finals ([https://en.wikipedia.org/wiki/Summative_assessment summative assessment]). Better strategies involve frequent, low-stakes ([https://en.wikipedia.org/wiki/Formative_assessment formative assessments]) that you and your students can use to guide their performance during the course of the semester. &lt;br /&gt;
&lt;br /&gt;
Creating a series of small mini-tests gives you a very flexible system for gauging performance and keeping students engaged in the class. Here are a few ideas for quick quizzes you can use as part of a larger assessment strategy.&lt;br /&gt;
&lt;br /&gt;
===Chapter checks===&lt;br /&gt;
Getting students to complete reading assignments has to be one of the hardest motivational tasks in education. Reading is critical to understanding most material, and fundamental to success in many classes. The problem for most students is there is no immediate reward or punishment for procrastinating on a reading assignment. If you haven&#039;t done the reading for a class discussion, you can either keep quiet, or, as I used to do occasionally, wing it by skimming in class. If you have a lecture course, there&#039;s almost no need to do the reading as the lecturer usually covers most of the material in class anyway. &lt;br /&gt;
&lt;br /&gt;
Creating a little mini-test for each reading assignment solves a number of problems. First, it encourages students to do the reading so they can do well on the quiz. Second, it gives the students feedback on how well they understood the reading assignment. Third, it gives you data about what aspects of the reading students found confusing, and which they have already mastered so you can focus your class activities.&lt;br /&gt;
&lt;br /&gt;
For a reading mini-test, I would recommend setting a limited time quiz students can only take once. Because it&#039;s a low-stakes activity you want students to use for self-assessment, I would also display feedback and correct answers. If you&#039;re concerned about students sharing answers after they&#039;ve taken the quiz, randomize the question and answer order. If you have a test bank, make some of the questions random as well. As an additional assignment, students should write down one question about a question they got wrong, and bring it to class.&lt;br /&gt;
&lt;br /&gt;
===Test practice===&lt;br /&gt;
The key to effective practice is to have a realistic practice environment. Many students worry about tests, especially high-stakes tests, because they have no idea what to expect. What question format will you use? How detailed will the questions be? What should they study?&lt;br /&gt;
&lt;br /&gt;
You can help alleviate test anxiety by creating a practice test students can take to help answer these questions. These tests are usually based on old questions similar to the current test questions. Use last year&#039;s final as an example test, which will force you into the practice of writing new questions every year. This is a good idea anyway, as you can be sure someone has a copy of last year&#039;s test they are sharing with others.&lt;br /&gt;
&lt;br /&gt;
To set up a practice test, I&#039;d create a zero point test with questions from the year before in random order with random answers. I would also allow students to take the test as many times as they’d like so they can test themselves as much as they need. Display feedback, but not correct answers so it presents more of a challenge.&lt;br /&gt;
&lt;br /&gt;
[[Gamification]] may be used for quiz practice. See the [[Quizventure activity]].&lt;br /&gt;
&lt;br /&gt;
===Data gathering===&lt;br /&gt;
&lt;br /&gt;
As an expert, you know a lot about your field. Your challenge as a teacher is to translate your knowledge for a novice who doesn&#039;t share your conceptual structure or experience. An example or lecture you think is brilliant may leave your students completely confused. It can be hard to tell what students really understand and what&#039;s leaving them baffled.&lt;br /&gt;
&lt;br /&gt;
A data-gathering quiz is similar to a chapter check, but it takes place after a class meeting or lecture. Your goal is to quickly get some feedback on student understanding of a lecture. What did they really understand? What do you need to spend more time on? I’ve found many instructors have trouble gauging what students find difficult, and what the students find so easy they are bored. &lt;br /&gt;
&lt;br /&gt;
Setting up a post-class data-gathering quiz is similar to creating a chapter check. Set the quiz for a limited time, like a day or two before the next meeting. Allow them to take it once and display feedback and correct answers. &lt;br /&gt;
&lt;br /&gt;
==Quiz security and cheating==&lt;br /&gt;
&lt;br /&gt;
Of course, online testing also presents another chance for the cheaters in your classes to try to game the system. Most online quizzes are meant to be taken at home, or at least outside of class. Students can download the questions and print them out. They can take the tests with other students, or while reading their textbooks.&lt;br /&gt;
&lt;br /&gt;
Fortunately, you can counter many of these strategies, making them more trouble than they are worth to the students. Let&#039;s look at a few strategies for countering most cheating schemes&lt;br /&gt;
&lt;br /&gt;
===Printing and sharing questions===&lt;br /&gt;
If you display feedback and correct answers, students can print the results page and share it with their friends. Or they can simply print the questions themselves directly from the quiz. The key to discouraging this behavior is to randomize the question order and the answer order. It makes the printouts a lot less useful. Creating larger question banks and giving tests with random subsets is also an effective strategy. If students can only print a small number of questions at a time, they will need to view the test again and again, then sort the questions to eliminate duplicates. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Warning: Assume there will be printed copies of your questions available to students who want them. Most instructors don’t realize students frequently have copies of old paper based tests, and electronic test delivery is another way for students to get copies of the questions. I know one professor who had over 1100 questions in his online test bank. At the end of the semester, he confiscated a printout from a student. It had every question with the correct answer, neatly formatted and divided by textbook chapter. We decided if students wanted to memorize 1100 questions and answers to the level where they could answer a small number of them displayed at random, then they would have learned more than if they had just studied. Of course, we used timed quizzes and other strategies to minimize using the print-out as a reference manual.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you activate the &#039;&#039;&#039;[[Safe Exam Browser]]&#039;&#039;&#039; settings and allow students only to take the quiz with this open-source lock-down browser, students cannot download or print the questions at all. But this setting add the hurdles that students have to install an additional (open-source) software on their devices.&lt;br /&gt;
&lt;br /&gt;
===Using the textbook===&lt;br /&gt;
Students will frequently look up the answer to questions in the textbook or a reading. If you are giving a chapter check quiz, then this is what you want them to do. Otherwise, you need to come up with creative ways of making the textbook less directly useful. Timed quizzes are the single most effective tool for eliminating this strategy. A timed quiz requires the students answer the questions in a certain amount of time. If you give enough questions and make the time short enough, they won&#039;t have time to look up all the answers. I usually give about 30 seconds per multiple-choice question. If they answer them faster and have time to look up some answers afterward, I figure they knew enough to deserve to look up an answer or two.&lt;br /&gt;
&lt;br /&gt;
Asking students to apply their knowledge to novel situation can also make a difference. Synthesis and application questions can&#039;t be looked up. Students have to understand the material and apply it creatively to answer the questions. So while they may take the time to review the text, they will still need to try to understand what they&#039;ve read to successfully answer the question.&lt;br /&gt;
&lt;br /&gt;
===Working with friends===&lt;br /&gt;
If your students are on the same campus, they may get together in a lab and try to take the quiz together. This is an easy strategy to thwart with random question order, random answer order and questions randomly pulled from a test bank. If my screen doesn&#039;t look like yours, then it&#039;s harder for us to quickly answer all of the questions. A timed quiz also makes it harder for the two of us to cheat if we have different questions and we only have a short amount of time to answer.&lt;br /&gt;
&lt;br /&gt;
===Have someone else take the test===&lt;br /&gt;
The old adage goes “On the Internet, no one knows you’re a dog”, and no one knows who is actually taking the test. Students will sometimes pay classmates, or others who have taken the course in the past, to take online quizzes for them. There are two ways to counter this strategy. One, have an occasional proctored exam where students need to show ID. If they haven&#039;t taken the quizzes or done the work until then, they will do poorly on the proctored exam. To eliminate current classmates from taking each other&#039;s quizzes, only make them available for a short time. You could require everyone take the test within a 2- or 4-hour block. If the test is properly randomized, it will be very difficult to take it more than once during the testing period. The test taker will worry about their own grade first, then about their employer&#039;s grade.&lt;br /&gt;
&lt;br /&gt;
Obviously, there are many strategies students can use to cheat. While it would be naïve to assume there isn&#039;t cheating, the vast majority of your students want to succeed on their own merits. The anonymity of the online environment may open up new avenues for the cheaters, but it&#039;s not really much different from your face-to-face classes. A few people will go to great lengths to cheat, but most will be honest as long as it&#039;s not too easy to get away with it. A few precautions will eliminate most of the easy cheats, and the classic strategies will work for the others.&lt;br /&gt;
&lt;br /&gt;
==Robust testing with random variants==&lt;br /&gt;
&lt;br /&gt;
This section describes a good way to help minimise the potential for cheating, and increase the opportunity for students to learn from the feedback by repeated attempts at the quiz. The basic idea is to take each particular question that you were thinking of, and make several slight variants of it. Then use Moodle&#039;s random question feature, so that each student gets one of the variants picked at random.&lt;br /&gt;
&lt;br /&gt;
===An example===&lt;br /&gt;
&lt;br /&gt;
A good example of this (although not in Moodle) can be seen at https://students.open.ac.uk/openmark/mu120.m5omdemo/. Take that test once, making a rough note of the questions you are asked. Then after you have done &#039;End test&#039;, do &#039;Restart entire test&#039; and see that you are asked a different set of questions that have different answers, although they test the same knowledge. This sort of strategy is easier to implement in some subjects than in others.&lt;br /&gt;
&lt;br /&gt;
===How to set this up in Moodle===&lt;br /&gt;
&lt;br /&gt;
Suppose we are going to create a quiz with 6 questions about interpreting diagrams (that is, we are going to try to clone the OpenMark example above). For the fourth question, the closest we will be able to get would be [https://moodle.org/plugins/qtype_ddmarker the Image target question type from the Modules and plugins database].&lt;br /&gt;
&lt;br /&gt;
====1. Create a category for each &#039;question&#039; in the quiz====&lt;br /&gt;
&lt;br /&gt;
As you can see from the screen shot, I have created six appropriately named categories, all neatly grouped inside a parent category. You do this on the &#039;Categories&#039; tab of the question bank interface.&lt;br /&gt;
&lt;br /&gt;
[[Image:Variants_categories.png]]&lt;br /&gt;
&lt;br /&gt;
====2. Create the first variant of the first question====&lt;br /&gt;
&lt;br /&gt;
Create the first variant of the first question, just like you would create any other Moodle question.&lt;br /&gt;
&lt;br /&gt;
In our example, this might be an Embedded answers (Cloze) question type. The question text might be:&lt;br /&gt;
&lt;br /&gt;
:Below is a plan of a proposed garden. The scale is that each division in the plan represents a length in the garden of 0.5 metres. What is the proposed length and width of the Patio in the garden?      &lt;br /&gt;
: [[Image:Variants_flowerbed.gif]]&lt;br /&gt;
: The Patio is {&#039;&#039;CLOZE syntax&#039;&#039;} metres by {&#039;&#039;CLOZE syntax&#039;&#039;} metres.&lt;br /&gt;
&lt;br /&gt;
====3. Create the other variants of the first question====&lt;br /&gt;
&lt;br /&gt;
To easily create a variant, click the duplicate icon next to the first question, then make the changes you need to turn it into the second variant and save it. Repeat this process to create as many variants as you want. &lt;br /&gt;
&lt;br /&gt;
In our example, we might change the word Patio, and the scale factor each division represents 0.5 metres. We would also need to change the answers and the associated feedback in the {&#039;&#039;CLOZE syntax&#039;&#039;} bits.&lt;br /&gt;
&lt;br /&gt;
====4. Repeat 2. and 3. for the other questions====&lt;br /&gt;
&lt;br /&gt;
The screen shots show the variants of the third question. This one is a bit more of a pain to set up, because each variant will use a different image of a pie chart, so there is a bit more editing to do, and more files to upload to the course files area.&lt;br /&gt;
&lt;br /&gt;
[[Image:Variants_questionsincat.png]]&lt;br /&gt;
&lt;br /&gt;
====5. Add the questions to the quiz====&lt;br /&gt;
&lt;br /&gt;
Once you have created all the questions, add them to the quiz using the &#039;Add random question&#039; feature. Select the first category (Reading a plan variants). Ensure &#039;Display questions from sub-categories too&#039; is off. Use the controls at the bottom to Add 1 random question to the quiz.&lt;br /&gt;
&lt;br /&gt;
Repeat for each of the other categories in order.&lt;br /&gt;
&lt;br /&gt;
[[Image:Variants_quiz.png]]&lt;br /&gt;
&lt;br /&gt;
===Creating variant questions in Atto===&lt;br /&gt;
In 2016, a new additional plugin, the [[Cloze editor for Atto]] has a &#039;Duplicate&#039; button, that allows you to easily and quickly create many question variants.&lt;br /&gt;
&lt;br /&gt;
===Comments===&lt;br /&gt;
&lt;br /&gt;
Obviously this is more work to set up (although not three times as much work as creating one quiz). It is up to you to do the cost benefit analysis for your particular quiz. Note that once you have set this up, you are more likely to be able to reuse quizzes in future, because you have reduced the potential for simple copying of answers.&lt;br /&gt;
&lt;br /&gt;
As an alternative to &#039;Save as new question&#039;, you can use Moodle&#039;s import and export formats, and copy and paste in your text editor to create variants.&lt;br /&gt;
&lt;br /&gt;
One issue you have to worry about is, are all the variants you have made of each question really equally difficult? Moodle 2.0 will feature a new Statistics report which should help you analyse your quiz results to see how difficult each variant is.&lt;br /&gt;
&lt;br /&gt;
Experience shows that &#039;a few variants&#039; can normally be taken to be 3 variants. This is enough to ensure that two students working at neighbouring computers will mostly get different questions to each other. More is better (providing you can ensure equal difficulty) but is more work, so you get diminishing returns.&lt;br /&gt;
&lt;br /&gt;
(This section expands some of the advice above under [[#Printing and sharing questions|Printing and sharing questions]]. It also describes how most online assessments at the Open University are constructed. The [[calculated question type]] is sometimes another way to implement quizzes like this.)&lt;br /&gt;
&lt;br /&gt;
==Certainty Based Marking==&lt;br /&gt;
* To make students think about how reliable their answer is.&lt;br /&gt;
* To encourage students to try to understand the issues, not just react immediately to a question.&lt;br /&gt;
* To challenge: if a student won&#039;t risk losing marks if wrong then they don&#039;t really know the answer.&lt;br /&gt;
* If a student is a careful thinker but not very confident. they will gain in confidence.&lt;br /&gt;
* It is more fair - a thoughtful and confident correct answer deserves more marks than a lucky hunch.&lt;br /&gt;
* Students need to pay attention if they make confident wrong answers: think, reflect, learn!&lt;br /&gt;
* Efficient study requires constantly questioning how our ideas arise and how reliable they are.&lt;br /&gt;
&lt;br /&gt;
See [[Using certainty-based marking]].&lt;br /&gt;
&lt;br /&gt;
==Proctored exams==&lt;br /&gt;
* As a start, check the info in this discussion: https://moodle.org/mod/forum/discuss.php?d=399255#p1610674. Use advance search for the forums, as there has been a bunch of discussion in 2020 about this subject.&lt;br /&gt;
&lt;br /&gt;
* One of the better solutions seen recently for lockdown testing, was a combination of things:&lt;br /&gt;
**Use of the safe browser and have the proctor call the student via some form of video call. &lt;br /&gt;
**Have the student show the proctor their computer setup and the room the test will be taken in. &lt;br /&gt;
**Then, have the student set up the phone in a position showing the student and their computer screen, as best they can from across the room. &lt;br /&gt;
**This allows the proctor to watch and hopefully, see any attempts to cheat.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Safe exam browser]] The Safe Exam Browser can work with Moodle to control what a student can do when in Moodle. To use it, it must be enabled the [[Quiz settings]]. This adds some additional options which could be chosen directly in the quiz settings. &lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=399255#p1610674  Implementing remotely invigilated online exams at scale] - The key lessons and successes of the University of New England&#039;s experience in implementing large scale remotely invigilated (proctored) online exams&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=141003 How do you keep people from cheating while taking a quiz?]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=271100#p1168345 User dependent locking and unlocking of quizzes]&lt;br /&gt;
&lt;br /&gt;
External links:&lt;br /&gt;
* [https://www.openlms.net/blog/products/30-tips-for-creating-quiz-questions-lms/ 30 tips for creating quiz questions] by Rebecca DeSantis, MSIT, Moodlerooms Instructional Designer&lt;br /&gt;
* [https://www.alfiekohn.org/article/whos-cheating/ Who is Cheating Whom] article&lt;br /&gt;
* [https://www.unmc.edu/facdev/_documents/ConstructingWrittenTestQuestions_WritingManual.pdf Constructing written test questions for the basic and clinical sciences] - by the National Board of Medical Examiners (USA)&lt;br /&gt;
&lt;br /&gt;
[[es:Prácticas Eficaces en los Exámenes]]&lt;br /&gt;
[[de:Tests effektiv durchführen]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Upload_users&amp;diff=145540</id>
		<title>Upload users</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Upload_users&amp;diff=145540"/>
		<updated>2023-02-19T15:03:37Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Accounts}}&lt;br /&gt;
==Uploading users via text file==&lt;br /&gt;
There are many options for uploading information (fields associated with a user) with this method: from enrolling users in multiple courses with course specific [[roles]] to updating user information in the [[User profile]] to deleting users from the site.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; It is usually not necessary to upload users in bulk with Upload users. To keep maintenance work down you should first explore forms of authentication that do not require manual maintenance, such as [[External database authentication|connecting to existing external databases]] or letting the users create their own accounts ([[Self enrolment]]). See [[Authentication]] for more information.&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/UCuOOGD7XPI| desc = How to bulk upload users and add to courses}}&lt;br /&gt;
==File formats for upload users file==&lt;br /&gt;
The upload users file has fields separated by a comma (or other delimiter) ONLY - no space. The first line contains the valid field names. The rest of the lines (records) contain information about each user.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; Avoid special characters in field information like quotes or other commas. Test a file with only one record before a large upload.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; You can use a spread sheet program to create the file with the required columns and fields. Then save the file as &amp;quot;CSV (comma delimited)&amp;quot;. These files can be opened with simple text editors (e.g., [https://notepad-plus-plus.org/ Notepad++]) for verification. &lt;br /&gt;
===Valid upload file for testing===&lt;br /&gt;
*From Site administration / Users / Upload users, an example text (.csv) file is available. It includes can be downloaded and adapted to your needs. &lt;br /&gt;
username,firstname,lastname,email&lt;br /&gt;
&lt;br /&gt;
student1,Student,One,s1@example.com&lt;br /&gt;
&lt;br /&gt;
student2,Student,Two,s2@example.com&lt;br /&gt;
&lt;br /&gt;
student3,Student,Three,s3@example.com&lt;br /&gt;
*Additional fields can be added as below. The course and cohort must already have been manually created.&lt;br /&gt;
username,firstname,lastname,email,course1,group1,cohort1&lt;br /&gt;
&lt;br /&gt;
student1,Student,One,s1@example.com,math102,groupA,cohortZ&lt;br /&gt;
&lt;br /&gt;
student2,Student,Two,s2@example.com,math102,groupB,cohort Y&lt;br /&gt;
&lt;br /&gt;
student3,Student,Three,s3@example.com,math102,groupA,cohortZ&lt;br /&gt;
== User Fields that can be included==&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; We strongly recommend that you test a file that contains fields you proposed to use with one user before attempting a file upload for the first time. &lt;br /&gt;
===Required fields===&lt;br /&gt;
These are the required user identification fields:&lt;br /&gt;
&amp;lt;code&amp;gt;username,firstname,lastname,email&amp;lt;/code&amp;gt;&lt;br /&gt;
Validity checks are performed for:&lt;br /&gt;
* &#039;&#039;&#039;username&#039;&#039;&#039; can only contain alphabetical &#039;&#039;&#039;lowercase&#039;&#039;&#039; letters, numbers, hypen &#039;-&#039;, underscore &#039;_&#039;, period &#039;.&#039;, or at-sign &#039;@&#039; &lt;br /&gt;
* &#039;&#039;&#039;email&#039;&#039;&#039; is in the form: &#039;&#039;name@example.com&#039;&#039;&lt;br /&gt;
===Passwords===&lt;br /&gt;
The &amp;quot;password&amp;quot; field is optional if the &#039;New user password&#039; setting on the upload screen is set to &amp;quot;Create password if needed and send via email&amp;quot; but is required if the setting is &amp;quot;Field required in file&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If included, values should meet the requirements for the site&#039;s [[Site policies#Password policy|Password policy]]. &lt;br /&gt;
&lt;br /&gt;
To force password change for a particular user, set the password field to &#039;&#039;&#039;changeme&#039;&#039;&#039;. If omitted, a password will be generated for each user (during the next Cron job) and welcome e-mails sent out. The text for the welcome e-mail is in the language settings in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language customisation&#039;&#039; with a String identifier of &#039;newusernewpasswordtext&#039;.&lt;br /&gt;
===Optional user fields===&lt;br /&gt;
Note: Commas within a field must be encoded as &amp;amp;#44 - the script will decode these back to commas.&lt;br /&gt;
Tip: For Boolean fields with only two values, use &#039;&#039;&#039;0&#039;&#039;&#039; for false and &#039;&#039;&#039;1&#039;&#039;&#039;for true. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To provide values other than the default you can include one or more of these optional user fields:&lt;br /&gt;
&amp;lt;pre&amp;gt;institution,department,city,country,lang,auth,timezone,idnumber,icq,phone1,phone2,address,url,description,mailformat,maildisplay,maildigest,htmleditor,autosubscribe,interests,theme&amp;lt;/pre&amp;gt;&lt;br /&gt;
Most of the these are user profile fields or user preference fields that belong to the user profile and are the filled in the user or at manual creation. Some however require specific formats:&lt;br /&gt;
&lt;br /&gt;
See [[Additional name fields]] for more details. Key things to note are:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;country&#039;&#039;&#039; - use the country TWO LETTER CODE, in upper case, e.g. AU,ES,GB,US. These are all UPPER CASE. Using &amp;quot;au&amp;quot; or &amp;quot;es&amp;quot; or &amp;quot;USA&amp;quot; as a country code will result in a database error. If you are having trouble working out the two-letter code for a country, you can consult the list of [https://www.iso.org/obp/ui/#search country names and code elements] available on the ISO Website. A common error is to use UK for United Kingdom; it should be GB.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;lang&#039;&#039;&#039; - use the two letter (or extended four letter) code as defined in the Moodle language packs, e.g. en, es, en_us, de, in &#039;&#039;Site administration &amp;gt; Language &amp;gt; Language packs&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;auth&#039;&#039;&#039; - The auth field must be used if the site uses an alternative authentication method, such as LDAP, as otherwise the authentication method will default to manual and users using a different auth method won&#039;t be able to log in.&lt;br /&gt;
Use the shortname codes defined in Plugins &amp;gt; Authentication for the various types, e.g. manual, nlogin, ldap, cas, mnet, db, none. If you do not include an auth column, then newly created users will be created with the manual account type.&lt;br /&gt;
&lt;br /&gt;
You can set &amp;quot;auth&amp;quot; to &amp;quot;nologin&amp;quot; in your csv file which will mean that then created users cannot login.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;timezone&#039;&#039;&#039; - Should be in the format as found in the Location settings in terms of Zone/Region, e.g. Australia/Sydney, Asia/Kathmandu, Europe/Madrid, etc. The entry is case sensitive so Europe/London will work but europe/london will not.&lt;br /&gt;
&lt;br /&gt;
NOTE: Needed: settings for &#039;&#039;&#039;mailformat&#039;&#039;&#039;,&#039;&#039;&#039;maildisplay&#039;&#039;&#039;,&#039;&#039;&#039;htmleditor&#039;&#039;&#039;,&#039;&#039;&#039;autosubscribe&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;maildigest&#039;&#039;&#039; To prevent users from receiving a large number of emails from courses or forced subscription forums use the &#039;&#039;&#039;maildigest&#039;&#039;&#039;. The options for this field are 0 = No digest, 1 = Complete digest and 2 = Digest with just subjects.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;maildisplay&#039;&#039;&#039; allows you to set the email display option for a user. The options for this field are 0 = Hide my email address from non-privileged users, 1 = Allow everyone to see my email address and 2 = Allow only other course members to see my email address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;theme&#039;&#039;&#039; User themes may be added by using &#039;classic&#039;, &#039;boost&#039; or the name of any other installed theme. The value should be the short name of the theme, e.g. &#039;boost&#039; not &#039;Boost&#039;, &#039;fordson&#039; not &#039;Fordson&#039;.&lt;br /&gt;
===Custom profile field names===&lt;br /&gt;
These are optional and depend on whether you have created any custom profile fields in your site. The name of the header in file is of the form &#039;profile_field_xxxxx&#039; where xxxx is the unique shortname of custom user profile field name as you created it. &lt;br /&gt;
&lt;br /&gt;
The field name should match the case of the profile field shortname. So, for instance if the shortname of your custom profile field is all upper case, for example, &#039;&#039;DOB&#039;&#039;, then use a header of &#039;&#039;profile_field_DOB&#039;&#039; to match the case, not &#039;&#039;profile_field_dob&#039;&#039;, which will produce a &amp;quot;is not a valid field name&amp;quot; error. Likewise, a mixed case shortname such as &#039;&#039;Dob&#039;&#039; should have a header of &#039;&#039;profile_field_Dob&#039;&#039;. (The exception to this is if the shortname is all lower case, then any case will work in the field header, which is a historical quirk: but best practice is to match the case and you will avoid errors.)&lt;br /&gt;
&amp;lt;pre&amp;gt;profile_field_xxxxx&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;: To create a custom field &amp;quot;genre&amp;quot;, you must write a shortname &amp;quot;genre&amp;quot; in the new field, and write &amp;quot;profile_field_genre&amp;quot; in the header of the .csv file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For custom profile fields that are dates, use the ISO standard format YYYY-MM-DD, e.g. 2014-06-19 which will then be properly localized in the interfaced. For example, a field called dohire for date of hire, the fields could be:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,firstname,lastname,email,profile_field_dohire&lt;br /&gt;
blumbergh,Bill,Lumbergh,blumbergh@example.com,1990-02-19&lt;br /&gt;
pgibbons,Peter,BGibbons,pgibbons@example.com,1996-06-05&lt;br /&gt;
tsmykowski,Tom,Smykowski,tsmykowski@example.com,1970-01-01 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For custom profile fields that are a menu, use the corresponding value in the menu list from field as you defined it. For example: a custom field &#039;corporatedivision&#039; with one of three values &#039;Management&#039;, &#039;Development&#039; or &#039;Training&#039;. Just insert one of those three words (e.g. &#039;Training&#039;) as the value for that field. E.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,firstname,lastname,email,profile_field_corporatedivision&lt;br /&gt;
blumbergh,Bill,Lumbergh,blumbergh@example.com,Management&lt;br /&gt;
pgibbons,Peter,BGibbons,pgibbons@example.com,Development&lt;br /&gt;
tsmykowski,Tom,Smykowski,tsmykowski@example.com,Training &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Special user change fields===&lt;br /&gt;
Three special fields are used for managing user accounts, &#039;&#039;&#039;oldusername&#039;&#039;&#039;, &#039;&#039;&#039;deleted&#039;&#039;&#039; and &#039;&#039;&#039;suspended&#039;&#039;&#039;. [[#Allow_renames|See below for details]].&lt;br /&gt;
===Enrolment fields===&lt;br /&gt;
You may optionally enrol users in already existing courses using manual enrolment. Only manual enrolment is done this way; if the manual enrolment method is disabled in a course, then no enrol is done.&lt;br /&gt;
&lt;br /&gt;
You use fields in the upload file of this type:&lt;br /&gt;
&amp;lt;pre&amp;gt;course1,type1,role1,group1,enroltimestart1,enrolperiod1,enrolstatus1,course2,type2,role2,group2,enroltimestart2,enrolperiod2,enrolstatus2&amp;lt;/pre&amp;gt; etc.&lt;br /&gt;
Header fields &#039;&#039;&#039;must&#039;&#039;&#039; have a numeric suffix such that type1,role1,group1,enrolperiod1 and enrolstatus1 all apply to course1 for course&#039;&#039;&#039;1&#039;&#039;&#039; to course&#039;&#039;&#039;n&#039;&#039;&#039;. Even if you are just doing one course enrolment, you must still use the number 1 on the heading name, i.e. course1,role1, etc. Do not use the bare headings without numbers, e.g. course,role, etc. as those will generate an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;course#&#039;&#039;&#039; is the shortname of the course, if present the user will be enrolled in that course. Do not use the fullname of the course or it will generate an error. This field is the ONLY required field for a successful enrolment. All the others are optional. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type#&#039;&#039;&#039; sets the role to be used for the enrolment. A value of 1 is default course role, 2 is legacy Teacher role and 3 is legacy Non-editing Teacher.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;role#&#039;&#039;&#039; may be used to specify roles directly, using either role short name or the role id (numeric names of roles are not supported). Usually you will use the role name that is the shortname of the role as defined in Users &amp;gt; Permissions &amp;gt; Define roles, e.g. student, editingteacher. If the role column is left out, the users will be enroled in the course with the default role, which is normally student.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;group#&#039;&#039;&#039; may be used to assign users to groups in course, using name or id (numeric group names are not supported). NOTE: if the group does not already exist, it will be created.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enroltimestart#&#039;&#039;&#039; may be used to set the enrolment start time, for each course. If not explicitly set here, the enrolment start time is set to be today. To set a date: &amp;quot;2021-02-15&amp;quot; and to set a date and time &amp;quot;2021-02-15 15:30&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enrolperiod#&#039;&#039;&#039; may be used to set the enrolment duration, in days, for each course. If not explicitly set here, all the users will get the duration as set in the Manual enrolment method of the course (which defaults to 0 meaning unlimited.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;enrolstatus#&#039;&#039;&#039; is optional as by default all newly enrolled users are set to active. If used a value of 1, it will suspend users in the course and if a user is previously set as inactive / suspended then a value of 0 will unsuspend them and make them active again.&lt;br /&gt;
=== Cohort membership assignment===&lt;br /&gt;
You can assign users to any already existing Cohort by using only the &amp;quot;username&amp;quot; and the &amp;quot;Cohort ID&amp;quot; with just two fields in the file. Note that this is an exception to the usual case where the firstname, lastname and email address of the user are required.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;cohort#&#039;&#039;&#039; is the form to use and like enrolment in courses, you have to add a number to each header, so cohort1,cohort2, etc.&lt;br /&gt;
&lt;br /&gt;
Internal cohort ID numbers or non-numeric Cohort IDs of existing cohorts must be used; do not use the full name as this is not allowed. (Note that cohort ID is what is usually known elsewhere as the &amp;quot;shortname&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
Here is a sample CSV file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username,cohort1,cohort2&lt;br /&gt;
student1,nursing,2016class&lt;br /&gt;
student2,nursing,2014class&lt;br /&gt;
student3,nursing,2014class&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== MNet ===&lt;br /&gt;
Existing [[MNet]]users can be added to courses, groups or cohorts as below by using the field header &#039;&#039;&#039;mnethostid&#039;&#039;&#039;&lt;br /&gt;
#enrolling to courses: username+mnethostid+course required&lt;br /&gt;
#adding to group: username+mnethostid+course+group required&lt;br /&gt;
#adding to cohort: username+mnethostid+cohort required&lt;br /&gt;
#suspending/reviving accounts: username+mnethostid+suspended required&lt;br /&gt;
All other operations are ignored. You can not add users, delete them or update them (such as change names or email, profile fields, etc.)&lt;br /&gt;
=== Set system roles ===&lt;br /&gt;
Users may also be assigned to already defined system roles, using the shortname of the system role as defined in &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; for roles with a system context defined.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sysrole1,sysrole2,sysrole3&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
&lt;br /&gt;
Users may be uploaded to a system role (usually Manager or Course creator) by entering the shortname of that role. Other roles can only be uploaded if they have already been assigned in the &#039;system&#039; context. See [[Creating custom roles]]. Multiple roles can be assigned using sysrole2, sysrole3, etc. fields. Note that the number suffix in no way relates to the number suffixes on the enrolment fields. The numbers must go up in sequence starting at 1.&lt;br /&gt;
&lt;br /&gt;
Unassigning system roles&lt;br /&gt;
Users can also be removed from a given system role by entering the shortname of that role prefixed with a minus symbol: &#039;-&#039;. If the user is currently assigned to that role, they are removed from it. If the user is not currently assigned to that system role, the field value is ignored. However, the field value must refer to a system role that does exist on the system, otherwise an error will occur.&lt;br /&gt;
[[File:GlobalRoles1.png|thumb|500px|center|Example of a file for uploading users with global/system roles]]&lt;br /&gt;
==Upload user process==&lt;br /&gt;
# Create file for uploading&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Accounts &amp;gt; Upload users&#039;&#039;&lt;br /&gt;
# Add file to upload&lt;br /&gt;
# Upload users preview - check settings and default user profile settings&lt;br /&gt;
# Upload users preview - click &amp;quot;Upload users&amp;quot;&lt;br /&gt;
# Upload users results - shows list of users, exceptions made in upload and summary of number of users&lt;br /&gt;
# Upload users results - click &amp;quot;Continue&amp;quot;&lt;br /&gt;
# Returns to Upload users screen&lt;br /&gt;
==Updating users preview==&lt;br /&gt;
There are various settings to better control the desired upload behaviour. These settings are found on the &amp;quot;Upload users preview&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: errors updating existing accounts can affect your users badly. &#039;&#039;&#039;&#039;&#039;Be careful&#039;&#039;&#039;&#039;&#039; when using the options to update.&lt;br /&gt;
====Upload type====&lt;br /&gt;
The Upload type specifies how to handle existing accounts.&lt;br /&gt;
;Add new only, skip existing users : is the default Moodle upload type. It creates a new user account for each new record in the uploaded file. If an existing username is found in the uploaded file matches an existing username, that record is &#039;&#039;&#039;skipped&#039;&#039;&#039;. By skipping the existing user account, the data in the existing record is not touched (in contrast to the &amp;quot;Add new and update existing users&amp;quot; option) and a second new user account is &#039;&#039;&#039;not&#039;&#039;&#039; created (in contrast to the &amp;quot;Add all, append number to usernames if needed&amp;quot; option). &lt;br /&gt;
&lt;br /&gt;
;Add all, append number to usernames if needed : creates a new user account for each record in the uploaded file. If an existing user account is found, a new account will be created with a number appended to the username. For example, if a user account for username &#039;jsmith&#039; already exists and a new record in the uploaded file contains a record forusername &#039;jsmith&#039; an additional user account is created with a 1 &#039;&#039;&#039;appended&#039;&#039;&#039; to the username to produce user &#039;jsmith1&#039;. &lt;br /&gt;
&lt;br /&gt;
;Add new and update existing users: creates a new user account for each new user in the upload file. If an existing user account with the same username is found, the account information is &#039;&#039;&#039;updated&#039;&#039;&#039; by the data in the uploaded file. &lt;br /&gt;
&lt;br /&gt;
;Update existing users only : ignores any new users found in the upload file and updates the user account if a matching username record is found in the uploaded file.&lt;br /&gt;
====New user password====&lt;br /&gt;
When creating a new user account Moodle can create a new password (if one is not provided) or require a password in the uploaded file.&lt;br /&gt;
;Create password if needed and send via email: creates a random default password for each new user account if one is not provided in the uploaded file, and emails the user their user information and new password.&lt;br /&gt;
&lt;br /&gt;
;Field required in file : requires that a password be provided in the uploaded file in order. If a password is not provided, an error is generated and the user account is not created. No notification of this user information or password is sent to the user.&lt;br /&gt;
====Existing user details====&lt;br /&gt;
The Existing user details options are only available when the Upload type allows existing user accounts to be updated. It specifies how Moodle should process user detail information for existing users.&lt;br /&gt;
;No changes : ignores user detail data in the uploaded file and leaves the existing user account data unchanged.&lt;br /&gt;
;Override with file : overwrites data in the existing user account with the data provided in the uploaded file.&lt;br /&gt;
;Override with file and defaults : overwrites data in the existing user account with data provided in the uploaded file and fills in the default values for existing user details when no data is provided in the uploaded file.&lt;br /&gt;
;Fill in missing from file and defaults : adds data in the existing user account with data provided in the uploaded file if the field is empty (does not already contain data) and fills in the default values for existing user details when no data is provided in the uploaded file.&lt;br /&gt;
====Existing user password====&lt;br /&gt;
The Existing user password option appears when you you have set the &amp;quot;Existing user details&amp;quot; setting to &amp;quot;Overwrite with file&amp;quot;. It specifies how to handle password data for existing user accounts, to change them or leave them as it. This is a bit of insurance to make sure that you really want to mass change user passwords.&lt;br /&gt;
;No changes : ignores password field in the uploaded user file and leaves the existing user account password untouched&lt;br /&gt;
;Update : overwrites the existing user account password with the password provided in the uploaded file&lt;br /&gt;
====Force password change====&lt;br /&gt;
The Force password change option specifies when to tag a user account so that the next login attempt will require the user to change the user&#039;s password.&lt;br /&gt;
;Users having a weak password : If the user account has a weak password as defined by the site&#039;s [[Password policy#Password policy|Password policy]] then the user will be forced to change the password during the next login attempt. This option is not shown if there the site does not have a [[Password policy#Password policy|Password policy]]. &lt;br /&gt;
;None : None of the users in the uploaded file will be forced to change the password during the user&#039;s next login attempt.&lt;br /&gt;
;All : All of the users in the uploaded file will be forced to change the password during the user&#039;s next login attempt.&lt;br /&gt;
====Allow renames====&lt;br /&gt;
If the uploaded file contains the special &#039;&#039;&#039;oldusername&#039;&#039;&#039; field, it is possible to rename a user from the &#039;&#039;&#039;oldusername&#039;&#039;&#039; to a new &#039;&#039;&#039;username&#039;&#039;&#039;. The default setting is to &#039;&#039;&#039;not&#039;&#039;&#039; allow renames. Keep in mind that renaming a user will require the user to use the new username when logging in.&lt;br /&gt;
;No : ignores the &#039;&#039;&#039;oldusername&#039;&#039;&#039; field and leaves the existing user account&#039;s username field unchanged.&lt;br /&gt;
;Yes : allows the existing user account&#039;s username to be changed by the data provided in the uploaded file&#039;s username field. The &#039;&#039;&#039;oldusername&#039;&#039;&#039; will be searched for and then updated with the data provided in the username column.&lt;br /&gt;
====Allow deletes====&lt;br /&gt;
If the uploaded file contains the &#039;&#039;&#039;deleted&#039;&#039;&#039; special field, it is possible to use the upload file to delete existing user accounts. The default setting is to &#039;&#039;&#039;not&#039;&#039;&#039; allow deletes. Keep in mind that deleting a user account will prevent that user from logging in. As a protection, site administrator user accounts cannot be deleted with this method. &lt;br /&gt;
;No : ignores the &#039;&#039;&#039;deleted&#039;&#039;&#039; special field in the uploaded file and leaves the existing user account unchanged&lt;br /&gt;
;Yes : allows the existing user account to be deleted when the value of the &#039;&#039;&#039;deleted&#039;&#039;&#039; field is 1. &lt;br /&gt;
====Allow suspending and activating of accounts====&lt;br /&gt;
If the uploaded file contains the &#039;&#039;&#039;suspended&#039;&#039;&#039; special field, it is possible to use the upload file to either suspend or make active (unsuspend) existing user accounts. The default setting is to allow suspending/activating of existing user accounts. Keep in mind that suspending an existing user account will prevent that user from logging in. &lt;br /&gt;
;Yes : allows the existing user account to be suspended when the value of the &#039;&#039;&#039;suspended&#039;&#039;&#039; field is 1. &lt;br /&gt;
;No : ignores the &#039;&#039;&#039;suspended&#039;&#039;&#039; special field in the uploaded file and leaves the existing user account status unchanged.&lt;br /&gt;
====Prevent email address duplicates====&lt;br /&gt;
It is possible, but &#039;&#039;&#039;not&#039;&#039;&#039; recommended to upload users with duplicate email addresses. By default, uploading users with duplicate email addresses is prevented. To allow duplicate email addresses, go to Site administration ► Plugins ► Authentication ► Manage authentication. You can tick &amp;quot;Allow accounts with same email&amp;quot;. Then on the upload users screen you will be allowed to change the &amp;quot;Prevent email address duplicates&amp;quot; setting. &lt;br /&gt;
&lt;br /&gt;
However, doing this is not recommended for file uploads. Test thoroughly any user uploads before implementing.&lt;br /&gt;
&lt;br /&gt;
For more info, see the [[Managing authentication#Allow accounts with same email|Managing authentication]] docs page&lt;br /&gt;
;Yes :prevents user accounts from being created from the uploaded if an existing user account already has the same email address as found in the uploaded file&#039;s &#039;&#039;&#039;email&#039;&#039;&#039; column.&lt;br /&gt;
;No :allows user accounts to be created if an existing user account already has the same email address found in the uploaded file&#039;s &#039;&#039;&#039;email&#039;&#039;&#039; column.&lt;br /&gt;
====Standardise usernames====&lt;br /&gt;
Standardise usernames is used by default to convert the username to all lower case and to strip out illegal characters. It is possible to not standardise the usernames; however, doing so is &#039;&#039;&#039;not&#039;&#039;&#039; recommended.&lt;br /&gt;
;Yes : standardises usernames found in the uploaded file before updating existing or creating new user accounts so that the username contains only lowercase letters and numbers.&lt;br /&gt;
;No : skips standardising usernames found in the uploaded file so that the newly created or updated usernames will be exactly as they are in the uploaded file (&#039;&#039;&#039;not recommended&#039;&#039;&#039;).&lt;br /&gt;
For those seeking a more technical explanation, the process for standardising the usernames consists of ensuring the characters are all UTF-8 (fix_utf8) encoded, converting the username to lower case, and then stripping out non-letters/non-number characters (unless &#039;&#039;Site administration &amp;gt; Security &amp;gt; Site policies &amp;gt; Allow extended characters in usernames&#039;&#039; is set on) with something similar to: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$username = preg_replace(&#039;/[^-\.@_a-z0-9]/&#039;, &#039;&#039;, $username);&amp;lt;/code&amp;gt;&lt;br /&gt;
====Select for bulk user actions====&lt;br /&gt;
After the uploaded file has finished being processed (all new accounts have been created and existing accounts updated as specified by the previous settings), there is an option to select some of those user accounts to perform additional [[admin/user/user bulk|bulk user actions]] such as &lt;br /&gt;
*Confirm user accounts created through Email-based self-registration which are not yet confirmed by the user&lt;br /&gt;
*Send a message (requires Messaging to be enabled)&lt;br /&gt;
*Delete user accounts&lt;br /&gt;
*Display a list of users on a page&lt;br /&gt;
*Download user data in text, ODS or Excel file format&lt;br /&gt;
*Force users to change their passwords&lt;br /&gt;
*Add users to a cohort&lt;br /&gt;
By default, no users are selected for [[admin/user/user bulk|bulk user actions]].&lt;br /&gt;
;No : No users are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
;New users : Only newly created users are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
;Updated users : Only updated user accounts are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
;All users : All users found (existing updated users and newly created user accounts) in the uploaded file are selected for [[admin/user/user bulk|bulk user actions]]&lt;br /&gt;
===Default values===&lt;br /&gt;
You can provide default user values for some fields not included in the uploaded file. Some fields include:&lt;br /&gt;
*Email display&lt;br /&gt;
*Forum auto-subscribe&lt;br /&gt;
*City/town&lt;br /&gt;
*ID number&lt;br /&gt;
*Institution&lt;br /&gt;
*Department&lt;br /&gt;
By clicking the &#039;&#039;&#039;Show more....&#039;&#039;&#039; link, other default user profile fields will show up. You can set 17 different fields here, including the Authentication method, Country. Language, Timezone, as well as most other standard User profile fields.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Other fields&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have created any custom profile fields for your users, they will show up here.&lt;br /&gt;
==Upload user results ==&lt;br /&gt;
After accepting the preview settings by clicking on &amp;quot;Upload users&amp;quot;, you should see the Upload users results screen.&lt;br /&gt;
[[File:Upload users results 2.0.JPG|thumb|center|The results screen; everything went well!]]&lt;br /&gt;
This screen will show you any exceptions or changes that were made to each user in the upload process. For example, if you were updating user information, the updated information will be shown. Or if a user was not added that record will be highlighted.&lt;br /&gt;
&lt;br /&gt;
The screen will summarize how many users were uploaded or updated, indicate the number of weak passwords and the number of errors.&lt;br /&gt;
==Advanced potentials of Upload user==&lt;br /&gt;
===Templates===&lt;br /&gt;
&#039;&#039;Note: This section needs checking and updating if necessary for Moodle 2.0. Please do so and remove this note when finished.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The default values are processed as templates in which the following codes are allowed:&lt;br /&gt;
* %l - will be replaced by the lastname&lt;br /&gt;
* %f - will be replaced by the firstname&lt;br /&gt;
* %u - will be replaced by the username&lt;br /&gt;
* %% - will be replaced by the %&lt;br /&gt;
Between the percent sign (%) and any code letter (l, f or u) the following modifiers are allowed:&lt;br /&gt;
* (-) minus sign - the information specified by the code letter will be converted to lowercase&lt;br /&gt;
* (+) plus sign - the information specified by the code letter will be converted to UPPERCASE&lt;br /&gt;
* (~) tilde sign - the information specified by the code letter will be converted to Title Case&lt;br /&gt;
* a decimal number - the information specified by the code letter will be truncated to that many characters&lt;br /&gt;
For example, if the firstname is John and the lastname is Doe, the following values will be obtained with the specified templates:&lt;br /&gt;
* %l%f = DoeJohn&lt;br /&gt;
* %l%1f = DoeJ&lt;br /&gt;
* %-l%+f = doeJOHN&lt;br /&gt;
* %-f_%-l = john_doe&lt;br /&gt;
*&amp;lt;nowiki&amp;gt; http://www.example.com/~%u/&amp;lt;/nowiki&amp;gt; results in &amp;lt;nowiki&amp;gt;http://www.example.com/~jdoe/&amp;lt;/nowiki&amp;gt; (if the username is jdoe or %-1f%-l)&lt;br /&gt;
Template processing is done only on default values, and not on the values retrieved from the CSV file.&lt;br /&gt;
&lt;br /&gt;
In order to create correct Moodle usernames, the username is always converted to lowercase. Moreover, if the &amp;quot;Allow extended characters in usernames&amp;quot; option in the Site policies page is off, characters different to letters, digits, dash (-) and dot (.) are removed. For example, if the firstname is John Jr. and the lastname is Doe, the username %-f_%-l will produce john jr._doe when Allow extended characters in usernames is on, and johnjr.doe when off.&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;New username duplicate handling&amp;quot; setting is set to Append counter, an auto-increment counter will be append to duplicate usernames produced by the template. For example, if the CSV file contains the users named John Doe, Jane Doe and Jenny Doe without explicit usernames, the default username is %-1f%-l and New username duplicate handling is set to Append counter, then the usernames produced will be jdoe, jdoe2 and jdoe3.&lt;br /&gt;
===Deleting accounts===&lt;br /&gt;
If the &#039;&#039;&#039;deleted&#039;&#039;&#039; field is present, users with value 1 for it will be deleted. In this case, all the fields may be omitted, except for &#039;&#039;&#039;username&#039;&#039;&#039;. After uploading the file, be sure to change the &amp;quot;Upload type&amp;quot; to &amp;quot;Update existing users only&amp;quot; and the &amp;quot;Allow deletes&amp;quot; option to &amp;quot;Yes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tip:&#039;&#039; A similar field is available for &#039;&#039;&#039;suspended&#039;&#039;&#039;. This enables a user account to be temporarily disabled rather than completely removed.&lt;br /&gt;
&lt;br /&gt;
Deleting and uploading accounts could be done with a single CSV file. For example, the following file will add the user Tom Jones and delete the user reznort:&lt;br /&gt;
 username,firstname,lastname,deleted&lt;br /&gt;
 jonest,Tom,Jones,0&lt;br /&gt;
 reznort,,,1&lt;br /&gt;
==Encoding file format==&lt;br /&gt;
On the initial Upload user screen, you may select the file encoding format from a pull down list. These include UTF-8 (the default), ASCII, ISO-8859-1 to ISO-8859-11 or any one of over 36 formats.&lt;br /&gt;
==Hints==&lt;br /&gt;
===Spreadsheet===&lt;br /&gt;
If you use a spreadsheet program such as Excel to create your .csv file, check the resulting output in a text editor before you upload it. It is possible to get trailing commas on each line from an empty field if you have added and deleted columns of information prior to saving the final file. Also check the character encoding. A csv file is a simple text file (ASCII or Unicode) that can be used to upload user accounts.&lt;br /&gt;
&lt;br /&gt;
Excel translates passwords that begin with - (minus) or + (plus) as zero. Even when saving as .csv and saying &amp;quot;Yes&amp;quot; to &amp;quot;Keep this format, and leave out any incompatible features.&amp;quot; Check for this before uploading, as a zero halts the upload process.&lt;br /&gt;
&lt;br /&gt;
If you use a formula in Excel to create fields (for example, the concatenate function to create a user name), then remember to copy the cells with the formula and use special paste with values checked to make them into an acceptable data for a csv file.&lt;br /&gt;
&lt;br /&gt;
The upload will also fail if you have trailing spaces at the end of your data fields. Often, this can not be removed with a simple Find &amp;quot; &amp;quot; and Replace with &amp;quot;&amp;quot;. If information has been copied from web sources than it is possible to include non-breaking spaces which will prevent your upload from being completed correctly. To find these invisible spaces, use the Find and Replace function in Excel. In the find field, hold alt and type 0160. Leave the replace field blank. &lt;br /&gt;
===Field size limits===&lt;br /&gt;
Some fields have maximum character lengths, as defined in the database fields. Typically the file will import to the preview list screen but not finish the process. Turn on debug to see the fields that are too long. The error will be &amp;quot;User not added - error&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The sizes of some common fields, in number of characters, are currently (3.2):&lt;br /&gt;
*username - 100 	 &lt;br /&gt;
*password - 255 	 &lt;br /&gt;
*idnumber - 255 	 &lt;br /&gt;
*firstname - 100 	 &lt;br /&gt;
*lastname - 100 	 &lt;br /&gt;
*lastnamephonetic - 255 	 &lt;br /&gt;
*firstnamephonetic - 255 	 &lt;br /&gt;
*middlename - 255 	 &lt;br /&gt;
*alternatename - 255 &lt;br /&gt;
*institution - 255&lt;br /&gt;
*department - 255 	 &lt;br /&gt;
*address - 255 	 &lt;br /&gt;
*city - 120 	 &lt;br /&gt;
*icq -15 	 &lt;br /&gt;
*skype - 50 	 &lt;br /&gt;
*yahoo - 50 	 &lt;br /&gt;
*aim - 50&lt;br /&gt;
*msn - 50 	 &lt;br /&gt;
*phone1 - 20 	 &lt;br /&gt;
*phone2 - 20&lt;br /&gt;
===All user fields listed here===&lt;br /&gt;
:All the user fields that are valid in an upload file are listed below, except for any custom fields you may have created (for which see below.)&lt;br /&gt;
&amp;lt;pre&amp;gt;firstname,lastname,username,email,password,auth,idnumber,institution,department,city,country,timezone,lang,mailformat,maildisplay,maildigest,htmleditor,autosubscribe,skype,msn,aim,yahoo,icq,phone1,phone2,address,url,description,descriptionformat,interests,oldusername,deleted,suspended,alternatename,lastnamephonetic,firstnamephonetic,middlename&amp;lt;/pre&amp;gt;&lt;br /&gt;
The enrolments into courses information are &amp;lt;pre&amp;gt;course1,type1,role1,group1,enrolperiod1,enrolstatus1&amp;lt;/pre&amp;gt;&lt;br /&gt;
where each enrolment is grouped by number.&lt;br /&gt;
===Capabilities===&lt;br /&gt;
You may wish to create a limited role to allow some users access to this function. Create a role at the system/site level with the following capabilities allowed:&lt;br /&gt;
* moodle/site:uploadusers&lt;br /&gt;
* moodle/role:assign&lt;br /&gt;
And &lt;br /&gt;
* In &#039;Allow role assignments&#039; tab of this new role, permit it to assign the required roles that it may be uploading, especially Student, but also Teacher, Non-editing Teacher, and any other custom roles you may have created, which will be used in the uploads to assign users to.&lt;br /&gt;
In particular, don&#039;t forget the moodle/role:assign capability (even if these users have it in the courses they will be enrolling users in - it won&#039;t work).&lt;br /&gt;
==Upload users via CLI==&lt;br /&gt;
In Moodle 3.10 onwards, an administrator can upload users via a CLI script.&lt;br /&gt;
&lt;br /&gt;
To obtain instructions on how to use the script, in the command line from the moodle directory run &lt;br /&gt;
 php admin/tool/uploaduser/cli/uploaduser.php --help&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Flat file]] enrolment&lt;br /&gt;
* [[User profile fields]] for details of how to include data about custom user profile fields in the upload users file&lt;br /&gt;
* [[Upload courses]]&lt;br /&gt;
Forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=97903 Uploading users to custom roles]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=144569 Matriculacion con flat file csv] - discussion in Spanish&lt;br /&gt;
[[fr:Importer des utilisateurs]]&lt;br /&gt;
[[ja:ユーザのアップロード]]&lt;br /&gt;
[[de:Nutzerliste hochladen]]&lt;br /&gt;
[[es:Subir usuarios]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Test_course_generator&amp;diff=140910</id>
		<title>Talk:Test course generator</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Test_course_generator&amp;diff=140910"/>
		<updated>2021-07-17T17:48:29Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Created page with &amp;quot;This page overlaps with https://docs.moodle.org/dev/JMeter and has not been updated recently.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page overlaps with https://docs.moodle.org/dev/JMeter and has not been updated recently.&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:JMeter_test_plan_generator&amp;diff=140909</id>
		<title>Talk:JMeter test plan generator</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:JMeter_test_plan_generator&amp;diff=140909"/>
		<updated>2021-07-17T17:46:58Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Created page with &amp;quot;This page overlaps with https://docs.moodle.org/dev/JMeter and not updated since 2014.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page overlaps with https://docs.moodle.org/dev/JMeter and not updated since 2014.&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Large_installations&amp;diff=140725</id>
		<title>Large installations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Large_installations&amp;diff=140725"/>
		<updated>2021-07-04T07:45:45Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Main page}}&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
Large scale Moodle infrastructures can be set up on different types of machines, from bare metal to compartmentalized virtual containers (or Kubernetes Pods).&amp;lt;br /&amp;gt;&lt;br /&gt;
In this section, we will try to share and put together some case study examples of such technological concepts of running very large scale Moodle systems.&lt;br /&gt;
&lt;br /&gt;
=== On premise ===&lt;br /&gt;
* Bare metal or Virtualization for Moodle [[Server_cluster]] setup.&lt;br /&gt;
&lt;br /&gt;
=== Public clouds ===&lt;br /&gt;
* [https://github.com/aws-samples/aws-refarch-moodle Amazon (AWS) EC2 (VMs)] with auto scaling groups and managed services (Storage, Caching, Database, CI/CD).&lt;br /&gt;
** [https://developerck.com/moodle-horizontal-scalable-aws/ Moodle Horizontal Scalable Deployment on AWS stack]&lt;br /&gt;
** [https://mxmartempresarial.com/caso-de-estudio-univa.html Hosting high availability Moodle on AWS] (Spanish)&lt;br /&gt;
** [https://www.erichartzog.com/blog/horz-scale-moodle Auto-Scaling Moodle Architecture on AWS 2015]&lt;br /&gt;
** [https://github.com/Tulkis/aws-ebs-moodle Moodle with AWS Elastic Beanstalk]&lt;br /&gt;
** Cloud infrastructure for high concurrency [https://moodle.com/wp-content/events/mootglobal19/Cloudinfrastructureforhighconcurrency.pdf slides], [https://www.youtube.com/watch?v=j_mEOxy9_eo video] 2019 Moodle MOOT Global presentation.&lt;br /&gt;
* [https://ktree.com/blog/moodle-ha-setup-using-docker-over-aws.html Amazon (AWS) Docker containers] with auto scaling groups and managed services (Storage, Caching, Database, CI/CD).&lt;br /&gt;
* Google (GPC) Kubernetes including automated managed micro services (Storage, Caching, Database, CI/CD, document conversions) &lt;br /&gt;
* Microsoft (Azure) - [https://github.com/Azure/Moodle/ Deploy and Manage a Scalable Moodle Cluster on Azure]&lt;br /&gt;
&lt;br /&gt;
== Custom setup and Tips ==&lt;br /&gt;
* A list of [[Performance_recommendations]] tuning tweaks you should consider applying to your system.&lt;br /&gt;
* Bare metal vs Virtualization, consideration relevant to the specific way Moodle is built.&lt;br /&gt;
* [https://aws.amazon.com/efs/features/infrequent-access/ Save some budget with AWS infrequent access EFS]&lt;br /&gt;
* [https://techcommunity.microsoft.com/t5/azure-database-for-mysql/deploying-moodle-on-azure-things-you-should-know/ba-p/814054 Deploying Moodle on Azure – things you should know]&lt;br /&gt;
&lt;br /&gt;
== Community support ==&lt;br /&gt;
* Moodle [https://moodle.org/mod/forum/view.php?id=596 Hardware and performance] forum.&lt;br /&gt;
* [https://t.me/large_scale_moodle Large scale Moodle IT support] Telegram group (click to join)&lt;br /&gt;
&lt;br /&gt;
== List of Moodle systems by user count ==&lt;br /&gt;
This page was started in December 2005. Inclusion on these pages is by self selection and completely voluntary.  There are more sites which meet these criterion that are not listed.&lt;br /&gt;
&lt;br /&gt;
*[[Installations 1000 plus]] users&lt;br /&gt;
*[[Installations 5000 plus]] users&lt;br /&gt;
*[[Installations 10000 plus]] users&lt;br /&gt;
*[[Installations 30000 plus]] users&lt;br /&gt;
*[[Installations 250000 plus]] users&lt;br /&gt;
*[[Installations 300000 plus]] users&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[http://moodle.org/mod/choice/view.php?id=3934 How big is your Moodle site?] choice activity (Sorry, this activity is currently hidden)&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=36216 Chart of schools (by size) that are using Moodle] forum discussion&lt;br /&gt;
*[http://www.frappr.com/moodle World map of Moodle users]&lt;br /&gt;
*[http://moodle.org/stats/ Moodle statistics]&lt;br /&gt;
*[[Institutions that have Migrated to Moodle]]&lt;br /&gt;
*[https://moodle.com/news/safeguarding-scaling-large-university-moodle-environments Scaling large case studies from Moodle Certified Premium Partner Catalyst IT]&lt;br /&gt;
&lt;br /&gt;
[[ja:Moodleの大規模インストール]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Performance_recommendations&amp;diff=140724</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Performance_recommendations&amp;diff=140724"/>
		<updated>2021-07-03T07:09:42Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] (Note: Last updated May 2002) and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made has had any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
It can be interesting to install and use the [https://moodle.org/plugins/report_benchmark Benchmark plugin] in order to find the bottlenecks of your system that specifically affect Moodle or do a load test / stress test with tool like JMeter. See [https://docs.moodle.org/dev/JMeter moodledev JMeter documentation]&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore and cache areas (see [[Caching]]), but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
On very large, load-balanced, systems the performance of the shared components become critical. It&#039;s important that your shared file areas are properly tuned and that you use an effective cache (Redis is highly recommended). A good understanding of these areas of system administration should be considered a minimum requirement. &lt;br /&gt;
&lt;br /&gt;
===Server cluster===&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=88214 Installation for 3000 simultaneous users]&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (e.g. 4GB or more). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* If your &#039;moodledata&#039; area is going to be on relatively slow storage (e.g. NFS mount on to a NAS device) you will  have performance issues with the default cache configuration (which writes to this storage). See the page on [[Caching]] and choose an alternative. Redis is recommended. Using [https://en.wikipedia.org/wiki/GlusterFS GlusterFS] / [https://en.wikipedia.org/wiki/OCFS2 OCFS2] / [https://en.wikipedia.org/wiki/GFS2 GFS2] on a [https://en.wikipedia.org/wiki/Storage_Area_Network SAN] device and [https://en.wikipedia.org/wiki/Fibre_Channel Fiber Channel] could improve performance (See more info on the Moodle [https://moodle.org/mod/forum/discuss.php?d=214680#p1123124 forum thread], [https://moodle.org/mod/forum/discuss.php?d=310501#p1242382 NFS performance tuing] )&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the [https://moodle.org/mod/forum/discuss.php?d=310501#p1242382 &amp;quot;async&amp;quot; and &amp;quot;noatime&amp;quot;] options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules], full text [http://developer.yahoo.com/performance/rules.html Best Practices for Speeding Up Your Web Site], &amp;lt;strike&amp;gt;([http://video.yahoo.com/video/play?vid=1040890 video])&amp;lt;/strike&amp;gt; for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* PHP contains a built-in accelerator. Make sure it is enabled. &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS6 ISAPI module&#039;&#039;&#039; (rather than a CGI). IIS 7.0/7.5 (Windows Server 2008/R2) users should choose a FastCGI installation for best performance.&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini. The default value for the memory_limit directive is 128M. On some sites, it may need to be larger - especially for some backup operations. &lt;br /&gt;
* Also see [[PHP_settings_by_Moodle_version]]&lt;br /&gt;
* Use [http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html PHP-FPM] (with apache).&lt;br /&gt;
&lt;br /&gt;
===Install HowTo===&lt;br /&gt;
==== APC ====&lt;br /&gt;
* [http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html APC on CentOS 5.x (linux)]&lt;br /&gt;
* [http://fplanque.com/dev/linux/install-apc-php-cache-debian-lenny APC on Debian (linux)]&lt;br /&gt;
==== eAccelerator ====&lt;br /&gt;
* [http://noveckg.blogspot.com/2010/02/installing-eaccelerator-cache-for-php.html Installing eAccelerator on CentOS 5.x (linux)]&lt;br /&gt;
* [https://docs.moodle.org/en/Installing_eAccelerator_In_Ubuntu_Server/ Installing eAccelerator on Ubuntu Server (linux)]&lt;br /&gt;
==== MemCached ====&lt;br /&gt;
Memcached server (daemon)&lt;br /&gt;
* [https://www.tecmint.com/install-memcached-on-centos-7/ Installing Memcached on CentOS 7.x (linux)] (as of php 7.x, only memcached is available)&lt;br /&gt;
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-memcached-on-centos-7 How To Install and Secure Memcached on CentOS 7]&lt;br /&gt;
* [https://wiki.zimbra.com/wiki/Blocking_Memcached_Attack#Iptables_rules_for_Redhat_based_servers Iptables rules for Redhat based servers]&lt;br /&gt;
Memcached PHP 7.1 extension &lt;br /&gt;
* [https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/repoview/php71u-pecl-memcached.html php71u-pecl-memcached] from IUS CentOS 7.x repository.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxRequestWorkers&#039;&#039;&#039; directive correctly (&#039;&#039;&#039;MaxClients&#039;&#039;&#039; before Apache 2.4). Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxRequestWorkers = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB but Moodle can easily use up to 100MB per process, so a general rule of thumb is to divide your available memory in megabytes by 100 to get a conservative setting for MaxClients. You are quite likely to find yourself lowering the MaxRequestWorkers from its default of 150 on a Moodle server. To get a more accurate estimate read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxRequestWorkers&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxRequestWorkers higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxConnectionsPerChild&#039;&#039;&#039; (&#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; before Apache 2.4) in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
&lt;br /&gt;
* Compression reduces response times by reducing the size of the HTTP response&lt;br /&gt;
# Install and enable mod_deflate - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;ifModule mod_deflate.c&amp;gt;&lt;br /&gt;
   AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/javascript text/css application/javascript&lt;br /&gt;
 &amp;lt;/ifmodule&amp;gt;&lt;br /&gt;
* Use Apache [http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html event] [http://httpd.apache.org/docs/current/mpm.html MPM] (and not the default Prefork or Worker)&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd, NginX and Cherokee performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd],  [http://nginx.net/ nginx] or [http://www.cherokee-project.com/ cherokee] in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
Do note that these are likely to be the least tested server environments of all particularly if you are using advanced features such as web services and/or Moodle Networking. They are probably best considered for heavily used Moodle sites with relatively simple configurations.&lt;br /&gt;
&lt;br /&gt;
===X-Sendfile===&lt;br /&gt;
&lt;br /&gt;
X-Sendfile modules improve performance when sending large files from Moodle. It is recommended to configure your web server and Moodle to use this feature if available.&lt;br /&gt;
&lt;br /&gt;
Configure web server:&lt;br /&gt;
* Apache - https://tn123.org/mod_xsendfile/&lt;br /&gt;
* Lighttpd - http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file&lt;br /&gt;
* Nginx - http://wiki.nginx.org/XSendfile&lt;br /&gt;
&lt;br /&gt;
Enable support in config.php (see config-dist.php):&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//     $CFG-&amp;gt;xsendfile = &#039;X-Sendfile&#039;;           // Apache {@see https://tn123.org/mod_xsendfile/}&lt;br /&gt;
//     $CFG-&amp;gt;xsendfile = &#039;X-LIGHTTPD-send-file&#039;; // Lighttpd {@see http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file}&lt;br /&gt;
//     $CFG-&amp;gt;xsendfile = &#039;X-Accel-Redirect&#039;;     // Nginx {@see http://wiki.nginx.org/XSendfile}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure file location prefixes if your server implementation requires it:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//     $CFG-&amp;gt;xsendfilealiases = array(&lt;br /&gt;
//         &#039;/dataroot/&#039; =&amp;gt; $CFG-&amp;gt;dataroot,&lt;br /&gt;
//         &#039;/cachedir/&#039; =&amp;gt; &#039;/var/www/moodle/cache&#039;,    // for custom $CFG-&amp;gt;cachedir locations&lt;br /&gt;
//         &#039;/localcachedir/&#039; =&amp;gt; &#039;/var/local/cache&#039;,    // for custom $CFG-&amp;gt;localcachedir locations&lt;br /&gt;
//         &#039;/tempdir/&#039;  =&amp;gt; &#039;/var/www/moodle/temp&#039;,     // for custom $CFG-&amp;gt;tempdir locations&lt;br /&gt;
//         &#039;/filedir&#039;   =&amp;gt; &#039;/var/www/moodle/filedir&#039;,  // for custom $CFG-&amp;gt;filedir locations&lt;br /&gt;
//     );&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cron performance ==&lt;br /&gt;
&lt;br /&gt;
Cron is a very important part of the overall performance of moodle as many asynchronous processes are offloaded to cron, so it needs to be running and have enough through put to handle the work being given to it by the front ends.&lt;br /&gt;
&lt;br /&gt;
See [[Cron_with_Unix_or_Linux#High_performance_cron_tasks]]&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;number one thing&#039;&#039;&#039; you can do to improve MySQL performance is to read, understand and implement the recommendations in the [https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool.html Innodb Buffer Pool] article.&lt;br /&gt;
&lt;br /&gt;
The [https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html buffer pool size] can safely be changed while your server is running, as long as your server has enough memory (RAM) to accommodate the value you set.  On a machine that is dedicated to MySQL, you can safely set this value to 80% of available memory.&lt;br /&gt;
&lt;br /&gt;
Consider setting [https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_buffer_pool_instances innodb_buffer_pool_instances] to the number of cores, vCPUs, or chips you have available.  Adjust this value in accordance with the recommendations in the [https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html MySQL documentation].&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://mysqltuner.pl/ MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL (like [http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server this one]), and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Splitting &#039;&#039;&#039;mdl_log&#039;&#039;&#039; to several tables and using a VIEW with UNION to read them as one. (See Tim Hunt [https://moodle.org/mod/forum/discuss.php?d=243531#p1104165 explanation] on the Moodle forums)&lt;br /&gt;
&lt;br /&gt;
=== Read replicas ===&lt;br /&gt;
&lt;br /&gt;
Since Moodle 3.9 you can configure read replica&#039;s to be used where possible. For very large systems as much as 80-90% of the DB load can be moved away from the primary. For configuration see config-dist:&lt;br /&gt;
&lt;br /&gt;
https://github.com/moodle/moodle/blob/master/config-dist.php#L84-L117&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. &#039;&#039;php -f /path/to/moodle/directory/admin/cli/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming too many resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. This is being tested to optimize the SQL query.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. However, it has been getting better in recent versions, and we don&#039;t know of any good, up-to-date performance measurements. (Here is a [http://moodle.org/mod/forum/discuss.php?d=68579 case study from 2007 with 300 quiz users].). The following suggestions were described by [https://moodle.org/user/view.php?id=94615&amp;amp;course=5 Al Rachels] in [https://moodle.org/mod/forum/discuss.php?d=347126 this forum thread]:&lt;br /&gt;
** make sure both Moodle, and the operating system, are installed on a [https://en.wikipedia.org/wiki/Solid-state_drive solid state drive]&lt;br /&gt;
** upgrade to and use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7]&lt;br /&gt;
** run MySQLTuner and implement its recommendations&lt;br /&gt;
&lt;br /&gt;
See [[Performance settings]] for more information on performance-related Moodle settings.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle: [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance] forum&lt;br /&gt;
*[http://opensourceelearning.blogspot.be/2012/10/why-your-moodle-site-is-slow-five.html Why Your Moodle Site is Slow: Five Simple Settings] blog post from Jonathan Moore &lt;br /&gt;
*I teach with Moodle perfomance testing: http://www.iteachwithmoodle.com/2012/11/17/moodle-2-4-beta-performance-test-comparison-with-moodle-2-3/&lt;br /&gt;
*[http://jfilip.ca/2013/08/20/moodle-2-4-5-vs-2-5-1-performance-and-muc-apc-cache-store/ Moodle 2.4.5 vs 2.5.2 performance and MUC APC cahe store]&lt;br /&gt;
*[http://jfilip.ca/2013/09/25/moodle-performance-testing-2-4-6-vs-2-5-2-vs-2-6dev/ Moodle performance testing 2.4.6 vs 2.5.2 vs 2.6dev]&lt;br /&gt;
*[http://jfilip.ca/2013/09/24/moodle-performance-analysis-revisted-now-with-mariadb/ Moodle performance analysis revisited (now with MariaDB)]&lt;br /&gt;
*[http://tjhunt.blogspot.ca/2013/05/performance-testing-moodle.html Tim Hunt&#039;s blog (May 2, 2013) on performance testing Moodle]&lt;br /&gt;
*[http://newrelic.com/ New Relic, Application Performance Monitoring]&lt;br /&gt;
*[http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html Performance enhacements for Apache and PHP (Apache Event MPM and PHP-FPM)]&lt;br /&gt;
*[https://scholarlms.net/performance-recommendations/ Performance recommendations]&lt;br /&gt;
*[https://enovation.ie/moodle-performance-investigation-using-performance-info/ Moodle performance investigation – using performance info ]&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=240391#unread Advice on optimising php/db code in moodle2+]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=243531 Moodle 2.5 performance testing at the OU]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=273602 100 active users limit with 4vCPU]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=336603#p1356423 Performance Tip ... shared...]&lt;br /&gt;
&lt;br /&gt;
[[es:Recomendaciones sobre desempeño]]&lt;br /&gt;
[[fr:Recommandations_de_performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[de:Geschwindigkeitsempfehlungen]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Performance_recommendations&amp;diff=140723</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Performance_recommendations&amp;diff=140723"/>
		<updated>2021-07-03T07:08:00Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made has had any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
It can be interesting to install and use the [https://moodle.org/plugins/report_benchmark Benchmark plugin] in order to find the bottlenecks of your system that specifically affect Moodle or do a load test / stress test with tool like JMeter. See [https://docs.moodle.org/dev/JMeter moodledev JMeter documentation]&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore and cache areas (see [[Caching]]), but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
On very large, load-balanced, systems the performance of the shared components become critical. It&#039;s important that your shared file areas are properly tuned and that you use an effective cache (Redis is highly recommended). A good understanding of these areas of system administration should be considered a minimum requirement. &lt;br /&gt;
&lt;br /&gt;
===Server cluster===&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=88214 Installation for 3000 simultaneous users]&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (e.g. 4GB or more). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* If your &#039;moodledata&#039; area is going to be on relatively slow storage (e.g. NFS mount on to a NAS device) you will  have performance issues with the default cache configuration (which writes to this storage). See the page on [[Caching]] and choose an alternative. Redis is recommended. Using [https://en.wikipedia.org/wiki/GlusterFS GlusterFS] / [https://en.wikipedia.org/wiki/OCFS2 OCFS2] / [https://en.wikipedia.org/wiki/GFS2 GFS2] on a [https://en.wikipedia.org/wiki/Storage_Area_Network SAN] device and [https://en.wikipedia.org/wiki/Fibre_Channel Fiber Channel] could improve performance (See more info on the Moodle [https://moodle.org/mod/forum/discuss.php?d=214680#p1123124 forum thread], [https://moodle.org/mod/forum/discuss.php?d=310501#p1242382 NFS performance tuing] )&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the [https://moodle.org/mod/forum/discuss.php?d=310501#p1242382 &amp;quot;async&amp;quot; and &amp;quot;noatime&amp;quot;] options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules], full text [http://developer.yahoo.com/performance/rules.html Best Practices for Speeding Up Your Web Site], &amp;lt;strike&amp;gt;([http://video.yahoo.com/video/play?vid=1040890 video])&amp;lt;/strike&amp;gt; for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* PHP contains a built-in accelerator. Make sure it is enabled. &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS6 ISAPI module&#039;&#039;&#039; (rather than a CGI). IIS 7.0/7.5 (Windows Server 2008/R2) users should choose a FastCGI installation for best performance.&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini. The default value for the memory_limit directive is 128M. On some sites, it may need to be larger - especially for some backup operations. &lt;br /&gt;
* Also see [[PHP_settings_by_Moodle_version]]&lt;br /&gt;
* Use [http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html PHP-FPM] (with apache).&lt;br /&gt;
&lt;br /&gt;
===Install HowTo===&lt;br /&gt;
==== APC ====&lt;br /&gt;
* [http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html APC on CentOS 5.x (linux)]&lt;br /&gt;
* [http://fplanque.com/dev/linux/install-apc-php-cache-debian-lenny APC on Debian (linux)]&lt;br /&gt;
==== eAccelerator ====&lt;br /&gt;
* [http://noveckg.blogspot.com/2010/02/installing-eaccelerator-cache-for-php.html Installing eAccelerator on CentOS 5.x (linux)]&lt;br /&gt;
* [https://docs.moodle.org/en/Installing_eAccelerator_In_Ubuntu_Server/ Installing eAccelerator on Ubuntu Server (linux)]&lt;br /&gt;
==== MemCached ====&lt;br /&gt;
Memcached server (daemon)&lt;br /&gt;
* [https://www.tecmint.com/install-memcached-on-centos-7/ Installing Memcached on CentOS 7.x (linux)] (as of php 7.x, only memcached is available)&lt;br /&gt;
* [https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-memcached-on-centos-7 How To Install and Secure Memcached on CentOS 7]&lt;br /&gt;
* [https://wiki.zimbra.com/wiki/Blocking_Memcached_Attack#Iptables_rules_for_Redhat_based_servers Iptables rules for Redhat based servers]&lt;br /&gt;
Memcached PHP 7.1 extension &lt;br /&gt;
* [https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/repoview/php71u-pecl-memcached.html php71u-pecl-memcached] from IUS CentOS 7.x repository.&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxRequestWorkers&#039;&#039;&#039; directive correctly (&#039;&#039;&#039;MaxClients&#039;&#039;&#039; before Apache 2.4). Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxRequestWorkers = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB but Moodle can easily use up to 100MB per process, so a general rule of thumb is to divide your available memory in megabytes by 100 to get a conservative setting for MaxClients. You are quite likely to find yourself lowering the MaxRequestWorkers from its default of 150 on a Moodle server. To get a more accurate estimate read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxRequestWorkers&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxRequestWorkers higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxConnectionsPerChild&#039;&#039;&#039; (&#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; before Apache 2.4) in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
&lt;br /&gt;
* Compression reduces response times by reducing the size of the HTTP response&lt;br /&gt;
# Install and enable mod_deflate - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;ifModule mod_deflate.c&amp;gt;&lt;br /&gt;
   AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/javascript text/css application/javascript&lt;br /&gt;
 &amp;lt;/ifmodule&amp;gt;&lt;br /&gt;
* Use Apache [http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html event] [http://httpd.apache.org/docs/current/mpm.html MPM] (and not the default Prefork or Worker)&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd, NginX and Cherokee performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd],  [http://nginx.net/ nginx] or [http://www.cherokee-project.com/ cherokee] in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
Do note that these are likely to be the least tested server environments of all particularly if you are using advanced features such as web services and/or Moodle Networking. They are probably best considered for heavily used Moodle sites with relatively simple configurations.&lt;br /&gt;
&lt;br /&gt;
===X-Sendfile===&lt;br /&gt;
&lt;br /&gt;
X-Sendfile modules improve performance when sending large files from Moodle. It is recommended to configure your web server and Moodle to use this feature if available.&lt;br /&gt;
&lt;br /&gt;
Configure web server:&lt;br /&gt;
* Apache - https://tn123.org/mod_xsendfile/&lt;br /&gt;
* Lighttpd - http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file&lt;br /&gt;
* Nginx - http://wiki.nginx.org/XSendfile&lt;br /&gt;
&lt;br /&gt;
Enable support in config.php (see config-dist.php):&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//     $CFG-&amp;gt;xsendfile = &#039;X-Sendfile&#039;;           // Apache {@see https://tn123.org/mod_xsendfile/}&lt;br /&gt;
//     $CFG-&amp;gt;xsendfile = &#039;X-LIGHTTPD-send-file&#039;; // Lighttpd {@see http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file}&lt;br /&gt;
//     $CFG-&amp;gt;xsendfile = &#039;X-Accel-Redirect&#039;;     // Nginx {@see http://wiki.nginx.org/XSendfile}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure file location prefixes if your server implementation requires it:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
//     $CFG-&amp;gt;xsendfilealiases = array(&lt;br /&gt;
//         &#039;/dataroot/&#039; =&amp;gt; $CFG-&amp;gt;dataroot,&lt;br /&gt;
//         &#039;/cachedir/&#039; =&amp;gt; &#039;/var/www/moodle/cache&#039;,    // for custom $CFG-&amp;gt;cachedir locations&lt;br /&gt;
//         &#039;/localcachedir/&#039; =&amp;gt; &#039;/var/local/cache&#039;,    // for custom $CFG-&amp;gt;localcachedir locations&lt;br /&gt;
//         &#039;/tempdir/&#039;  =&amp;gt; &#039;/var/www/moodle/temp&#039;,     // for custom $CFG-&amp;gt;tempdir locations&lt;br /&gt;
//         &#039;/filedir&#039;   =&amp;gt; &#039;/var/www/moodle/filedir&#039;,  // for custom $CFG-&amp;gt;filedir locations&lt;br /&gt;
//     );&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cron performance ==&lt;br /&gt;
&lt;br /&gt;
Cron is a very important part of the overall performance of moodle as many asynchronous processes are offloaded to cron, so it needs to be running and have enough through put to handle the work being given to it by the front ends.&lt;br /&gt;
&lt;br /&gt;
See [[Cron_with_Unix_or_Linux#High_performance_cron_tasks]]&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;number one thing&#039;&#039;&#039; you can do to improve MySQL performance is to read, understand and implement the recommendations in the [https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool.html Innodb Buffer Pool] article.&lt;br /&gt;
&lt;br /&gt;
The [https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html buffer pool size] can safely be changed while your server is running, as long as your server has enough memory (RAM) to accommodate the value you set.  On a machine that is dedicated to MySQL, you can safely set this value to 80% of available memory.&lt;br /&gt;
&lt;br /&gt;
Consider setting [https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_buffer_pool_instances innodb_buffer_pool_instances] to the number of cores, vCPUs, or chips you have available.  Adjust this value in accordance with the recommendations in the [https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html MySQL documentation].&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://mysqltuner.pl/ MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL (like [http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server this one]), and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Splitting &#039;&#039;&#039;mdl_log&#039;&#039;&#039; to several tables and using a VIEW with UNION to read them as one. (See Tim Hunt [https://moodle.org/mod/forum/discuss.php?d=243531#p1104165 explanation] on the Moodle forums)&lt;br /&gt;
&lt;br /&gt;
=== Read replicas ===&lt;br /&gt;
&lt;br /&gt;
Since Moodle 3.9 you can configure read replica&#039;s to be used where possible. For very large systems as much as 80-90% of the DB load can be moved away from the primary. For configuration see config-dist:&lt;br /&gt;
&lt;br /&gt;
https://github.com/moodle/moodle/blob/master/config-dist.php#L84-L117&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. &#039;&#039;php -f /path/to/moodle/directory/admin/cli/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming too many resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. This is being tested to optimize the SQL query.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. However, it has been getting better in recent versions, and we don&#039;t know of any good, up-to-date performance measurements. (Here is a [http://moodle.org/mod/forum/discuss.php?d=68579 case study from 2007 with 300 quiz users].). The following suggestions were described by [https://moodle.org/user/view.php?id=94615&amp;amp;course=5 Al Rachels] in [https://moodle.org/mod/forum/discuss.php?d=347126 this forum thread]:&lt;br /&gt;
** make sure both Moodle, and the operating system, are installed on a [https://en.wikipedia.org/wiki/Solid-state_drive solid state drive]&lt;br /&gt;
** upgrade to and use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7]&lt;br /&gt;
** run MySQLTuner and implement its recommendations&lt;br /&gt;
&lt;br /&gt;
See [[Performance settings]] for more information on performance-related Moodle settings.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle: [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance] forum&lt;br /&gt;
*[http://opensourceelearning.blogspot.be/2012/10/why-your-moodle-site-is-slow-five.html Why Your Moodle Site is Slow: Five Simple Settings] blog post from Jonathan Moore &lt;br /&gt;
*I teach with Moodle perfomance testing: http://www.iteachwithmoodle.com/2012/11/17/moodle-2-4-beta-performance-test-comparison-with-moodle-2-3/&lt;br /&gt;
*[http://jfilip.ca/2013/08/20/moodle-2-4-5-vs-2-5-1-performance-and-muc-apc-cache-store/ Moodle 2.4.5 vs 2.5.2 performance and MUC APC cahe store]&lt;br /&gt;
*[http://jfilip.ca/2013/09/25/moodle-performance-testing-2-4-6-vs-2-5-2-vs-2-6dev/ Moodle performance testing 2.4.6 vs 2.5.2 vs 2.6dev]&lt;br /&gt;
*[http://jfilip.ca/2013/09/24/moodle-performance-analysis-revisted-now-with-mariadb/ Moodle performance analysis revisited (now with MariaDB)]&lt;br /&gt;
*[http://tjhunt.blogspot.ca/2013/05/performance-testing-moodle.html Tim Hunt&#039;s blog (May 2, 2013) on performance testing Moodle]&lt;br /&gt;
*[http://newrelic.com/ New Relic, Application Performance Monitoring]&lt;br /&gt;
*[http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html Performance enhacements for Apache and PHP (Apache Event MPM and PHP-FPM)]&lt;br /&gt;
*[https://scholarlms.net/performance-recommendations/ Performance recommendations]&lt;br /&gt;
*[https://enovation.ie/moodle-performance-investigation-using-performance-info/ Moodle performance investigation – using performance info ]&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=240391#unread Advice on optimising php/db code in moodle2+]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=243531 Moodle 2.5 performance testing at the OU]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=273602 100 active users limit with 4vCPU]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=336603#p1356423 Performance Tip ... shared...]&lt;br /&gt;
&lt;br /&gt;
[[es:Recomendaciones sobre desempeño]]&lt;br /&gt;
[[fr:Recommandations_de_performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[de:Geschwindigkeitsempfehlungen]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=103796</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=103796"/>
		<updated>2013-03-31T20:53:06Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Deleted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Deleted [[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] 04:53, 1 April 2013 (WST)&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Step-by-step_Installation_Guide_for_Ubuntu&amp;diff=103795</id>
		<title>Talk:Step-by-step Installation Guide for Ubuntu</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Step-by-step_Installation_Guide_for_Ubuntu&amp;diff=103795"/>
		<updated>2013-03-31T20:44:13Z</updated>

		<summary type="html">&lt;p&gt;Ratna: chmod 777 ???&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Are you sure you going to leave the permissions at these:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo chmod 777 /var/moodledata&lt;br /&gt;
sudo chmod 777 /var/www/moodle&amp;lt;/pre&amp;gt;&lt;br /&gt;
???&lt;br /&gt;
[[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] 04:44, 1 April 2013 (WST)&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Installing_Moodle_on_Debian_based_distributions&amp;diff=103737</id>
		<title>Installing Moodle on Debian based distributions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Installing_Moodle_on_Debian_based_distributions&amp;diff=103737"/>
		<updated>2013-03-24T19:46:45Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Moved to my blog at www.syndrega.ch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moved to http://www.syndrega.ch/?p=38.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--- Categories --&amp;gt;&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=File:webbench-in-vb.png&amp;diff=97014</id>
		<title>File:webbench-in-vb.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=File:webbench-in-vb.png&amp;diff=97014"/>
		<updated>2012-04-17T14:12:22Z</updated>

		<summary type="html">&lt;p&gt;Ratna: uploaded a new version of &amp;amp;quot;File:webbench-in-vb.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=File:webbench-in-vb.png&amp;diff=97013</id>
		<title>File:webbench-in-vb.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=File:webbench-in-vb.png&amp;diff=97013"/>
		<updated>2012-04-17T14:10:49Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Cron_with_Unix_or_Linux&amp;diff=96748</id>
		<title>Talk:Cron with Unix or Linux</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Cron_with_Unix_or_Linux&amp;diff=96748"/>
		<updated>2012-03-31T22:00:55Z</updated>

		<summary type="html">&lt;p&gt;Ratna: /* Linux _is_ Unix, Mac OS too */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Since wget is being used to run the cron.php script anyway, you can really run this ANYWHERE ==&lt;br /&gt;
:Brought this comment from 2.0 Cron comment page.  It was unsigned/undated --[[User:chris collman|chris collman]] 20:09, 22 November 2011 (WST)&lt;br /&gt;
It is important to note that since the cron.php script is not run internally by Moodle, but by an outside interaction, you can really run a cron job on ANY server that runs the cron.php on your Moodle installation.&lt;br /&gt;
&lt;br /&gt;
So, for example, if you have a Moodle install at an ISP that does not let you run cron jobs, but you have, say, a DSLline at home, you can use any of your Linux computers at home to run cron.  (you do use Linux at home, right? :)&lt;br /&gt;
&lt;br /&gt;
And the beauty of it is, the crontab line is *exactly* the same as listed in the main article. It just points to an outside URL.&lt;br /&gt;
&lt;br /&gt;
Now, I mention this because at one point I had configured a server to run Moodle but, in the interest of security, I did not have wget available on the server.  (cron was available, but not wget).&lt;br /&gt;
&lt;br /&gt;
Well, the easiest thing to do was to just run a cron job somewhere else.&lt;br /&gt;
&lt;br /&gt;
Alrighty, seeyalater!&lt;br /&gt;
&lt;br /&gt;
== Update and clarify ==&lt;br /&gt;
:Brought this comment from 2.0 Cron comment page.  It was unsigned/undated --[[User:chris collman|chris collman]] 20:09, 22 November 2011 (WST)&lt;br /&gt;
&lt;br /&gt;
* The whole cronclionly vs. shell invocation vs. &amp;quot;using wget&amp;quot; is completely misleading.&lt;br /&gt;
** while you can call cron.php using a web browser or a command line web &amp;quot;browser&amp;quot; like wget, curl, lynx from outside or inside the server. The latter commands can be scripted, e.g. to be called by cron.&lt;br /&gt;
** the &amp;quot;cronclionly&amp;quot; checkbox restricts the call to cron.php to calling it from inside the server and only using &amp;quot;bin/php&amp;quot;. This can be scripted to be called by cron, as well.&lt;br /&gt;
* It should be said somewhere that using e.g. the &amp;quot;www-data&amp;quot; user in e.g. /etc/cron.d/moodle is far better than using /etc/crontab which is executed by root. AFAICS this is nowhere mentioned.&lt;br /&gt;
&lt;br /&gt;
== Linux _is_ Unix, Mac OS too ==&lt;br /&gt;
&lt;br /&gt;
Why does it say &amp;quot;Unix or Linux&amp;quot;? Linux _is_ Unix!&lt;br /&gt;
&lt;br /&gt;
One could say &amp;quot;Unix (and Linux)&amp;quot;. But then Mac OS X is Unix too.&lt;br /&gt;
&lt;br /&gt;
The best is to continue with the original article [Cron] and maintain the section &amp;quot;Unix&amp;quot; (it will be valid for Linux and Mac OS X).&lt;br /&gt;
[[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] 06:00, 1 April 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96120</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96120"/>
		<updated>2012-02-27T19:55:40Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|&lt;br /&gt;
&amp;lt;em&amp;gt;note a priori:&amp;lt;/em&amp;gt; Morbi ac quam risus, ultricies faucibus odio. Fusce eu ultricies velit. Cras lobortis dolor ut leo rhoncus vulputate. Donec eget felis tellus. Duis ac odio vitae eros egestas ornare vel ut leo. Curabitur bibendum, purus sit amet ultrices tincidunt, risus sapien dignissim libero, ac semper erat nunc et nisl. Quisque aliquam ornare blandit.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section One&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Qua soi &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; Aliquam leo augue, posuere eget facilisis eu, euismod sit amet quam. Sed ultrices est vitae arcu tristique malesuada mattis nibh feugiat. Aliquam libero justo, condimentum ut consectetur facilisis, imperdiet tempus velit. Sed consequat lacinia lacus a eleifend. Cras sed magna sem&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection One.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection One.one.one&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section Two&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Morbi gravida nisi ac metus pulvinar varius. Curabitur cursus libero metus, eu tempus lorem. Ut dictum scelerisque nisl, sit amet adipiscing velit commodo vitae. Donec a turpis enim, quis adipiscing elit. Mauris consequat euismod ligula eu eleifend. Integer nec elit risus. Donec eros nisi, laoreet eget interdum ultricies, elementum at tellus.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection Two.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsection Two.two&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem&amp;lt;ref&amp;gt;Asd adf ilkaa la asdf adf adfa aaa.&amp;lt;/ref&amp;gt; sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ &amp;lt;b&amp;gt;quo &amp;lt;var&amp;gt;vadis&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;var&amp;gt;apoko&amp;lt;/var&amp;gt;      pts/4        A.D. 2012-02-11 13:14 (:0.0)&lt;br /&gt;
 ; son qommone de mal&lt;br /&gt;
 ghande&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Curabitur mattis nisi eu nunc porttitor mattis. Praesent condimentum purus non libero blandit et viverra purus malesuada. Aliquam eget nulla vitae nunc tincidunt faucibus. Vestibulum tempus dui id quam elementum lobortis. Aliquam erat volutpat. Quisque sollicitudin lacinia orci et fringilla. Curabitur risus sem, volutpat non lobortis quis, suscipit a erat. In ac magna leo.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Reference list&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;External links&amp;lt;/h2&amp;gt;&lt;br /&gt;
[http://www.example.com/ http://www.example.com/] - lot of goodies&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--- Categories ---&amp;gt;&lt;br /&gt;
[[:Category:Nonsense:]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96095</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96095"/>
		<updated>2012-02-25T14:40:44Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|&lt;br /&gt;
&amp;lt;em&amp;gt;note a priori:&amp;lt;/em&amp;gt; Morbi ac quam risus, ultricies faucibus odio. Fusce eu ultricies velit. Cras lobortis dolor ut leo rhoncus vulputate. Donec eget felis tellus. Duis ac odio vitae eros egestas ornare vel ut leo. Curabitur bibendum, purus sit amet ultrices tincidunt, risus sapien dignissim libero, ac semper erat nunc et nisl. Quisque aliquam ornare blandit.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section One&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Qua soi &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; Aliquam leo augue, posuere eget facilisis eu, euismod sit amet quam. Sed ultrices est vitae arcu tristique malesuada mattis nibh feugiat. Aliquam libero justo, condimentum ut consectetur facilisis, imperdiet tempus velit. Sed consequat lacinia lacus a eleifend. Cras sed magna sem&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection One.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection One.one.one&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section Two&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Morbi gravida nisi ac metus pulvinar varius. Curabitur cursus libero metus, eu tempus lorem. Ut dictum scelerisque nisl, sit amet adipiscing velit commodo vitae. Donec a turpis enim, quis adipiscing elit. Mauris consequat euismod ligula eu eleifend. Integer nec elit risus. Donec eros nisi, laoreet eget interdum ultricies, elementum at tellus.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection Two.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsection Two.two&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem&amp;lt;ref&amp;gt;Asd adf ilkaa la asdf adf adfa aaa.&amp;lt;/ref&amp;gt; sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ &amp;lt;b&amp;gt;quo &amp;lt;var&amp;gt;vadis&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 &amp;lt;var&amp;gt;apoko&amp;lt;/var&amp;gt;      pts/4        A.D. 2012-02-11 13:14 (:0.0)&lt;br /&gt;
 ; son qommone de mal&lt;br /&gt;
 ghande&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Curabitur mattis nisi eu nunc porttitor mattis. Praesent condimentum purus non libero blandit et viverra purus malesuada. Aliquam eget nulla vitae nunc tincidunt faucibus. Vestibulum tempus dui id quam elementum lobortis. Aliquam erat volutpat. Quisque sollicitudin lacinia orci et fringilla. Curabitur risus sem, volutpat non lobortis quis, suscipit a erat. In ac magna leo.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Reference list&amp;lt;/h2&amp;gt;&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;External links&amp;lt;/h2&amp;gt;&lt;br /&gt;
[http://www.example.com/ http://www.example.com/] - lot of goodies&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--- Categories ---&amp;gt;&lt;br /&gt;
[[:Category:Nonsense:]]&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96033</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96033"/>
		<updated>2012-02-21T15:20:31Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|&lt;br /&gt;
&amp;lt;em&amp;gt;note a priori:&amp;lt;/em&amp;gt; Morbi ac quam risus, ultricies faucibus odio. Fusce eu ultricies velit. Cras lobortis dolor ut leo rhoncus vulputate. Donec eget felis tellus. Duis ac odio vitae eros egestas ornare vel ut leo. Curabitur bibendum, purus sit amet ultrices tincidunt, risus sapien dignissim libero, ac semper erat nunc et nisl. Quisque aliquam ornare blandit.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section One&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Qua soi &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; Aliquam leo augue, posuere eget facilisis eu, euismod sit amet quam. Sed ultrices est vitae arcu tristique malesuada mattis nibh feugiat. Aliquam libero justo, condimentum ut consectetur facilisis, imperdiet tempus velit. Sed consequat lacinia lacus a eleifend. Cras sed magna sem&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection One.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection One.one.one&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section Two&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Morbi gravida nisi ac metus pulvinar varius. Curabitur cursus libero metus, eu tempus lorem. Ut dictum scelerisque nisl, sit amet adipiscing velit commodo vitae. Donec a turpis enim, quis adipiscing elit. Mauris consequat euismod ligula eu eleifend. Integer nec elit risus. Donec eros nisi, laoreet eget interdum ultricies, elementum at tellus.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection Two.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsection Two.two&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 dodo      pts/4        2012-02-11 13:14 (:0.0)&lt;br /&gt;
 # comment or super user&lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Curabitur mattis nisi eu nunc porttitor mattis. Praesent condimentum purus non libero blandit et viverra purus malesuada. Aliquam eget nulla vitae nunc tincidunt faucibus. Vestibulum tempus dui id quam elementum lobortis. Aliquam erat volutpat. Quisque sollicitudin lacinia orci et fringilla. Curabitur risus sem, volutpat non lobortis quis, suscipit a erat. In ac magna leo. &amp;gt;&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96032</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=96032"/>
		<updated>2012-02-21T15:17:15Z</updated>

		<summary type="html">&lt;p&gt;Ratna: V1 for doc forum&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|&lt;br /&gt;
&amp;lt;em&amp;gt;note a priori:&amp;lt;/em&amp;gt; Morbi ac quam risus, ultricies faucibus odio. Fusce eu ultricies velit. Cras lobortis dolor ut leo rhoncus vulputate. Donec eget felis tellus. Duis ac odio vitae eros egestas ornare vel ut leo. Curabitur bibendum, purus sit amet ultrices tincidunt, risus sapien dignissim libero, ac semper erat nunc et nisl. Quisque aliquam ornare blandit.ppear on a yellow background.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section One&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Qua soi &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; Aliquam leo augue, posuere eget facilisis eu, euismod sit amet quam. Sed ultrices est vitae arcu tristique malesuada mattis nibh feugiat. Aliquam libero justo, condimentum ut consectetur facilisis, imperdiet tempus velit. Sed consequat lacinia lacus a eleifend. Cras sed magna sem&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection One.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection One.one.one&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Section Two&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Morbi gravida nisi ac metus pulvinar varius. Curabitur cursus libero metus, eu tempus lorem. Ut dictum scelerisque nisl, sit amet adipiscing velit commodo vitae. Donec a turpis enim, quis adipiscing elit. Mauris consequat euismod ligula eu eleifend. Integer nec elit risus. Donec eros nisi, laoreet eget interdum ultricies, elementum at tellus.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection Two.one&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsection Two.two&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 $ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 dodo      pts/4        2012-02-11 13:14 (:0.0)&lt;br /&gt;
 # comment or super user&lt;br /&gt;
 mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Curabitur mattis nisi eu nunc porttitor mattis. Praesent condimentum purus non libero blandit et viverra purus malesuada. Aliquam eget nulla vitae nunc tincidunt faucibus. Vestibulum tempus dui id quam elementum lobortis. Aliquam erat volutpat. Quisque sollicitudin lacinia orci et fringilla. Curabitur risus sem, volutpat non lobortis quis, suscipit a erat. In ac magna leo. &amp;gt;&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Installing_Moodle_on_Debian_based_distributions&amp;diff=95914</id>
		<title>Talk:Installing Moodle on Debian based distributions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Installing_Moodle_on_Debian_based_distributions&amp;diff=95914"/>
		<updated>2012-02-16T17:46:25Z</updated>

		<summary type="html">&lt;p&gt;Ratna: /* PHP modules and phpinfo() */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;TODO &lt;br /&gt;
Suggest that the mysql secure utility is used. I refer to it in my Amazon EC2 install page. Copy &amp;amp; paste from there.&lt;br /&gt;
Mention the various extra that need to be installed php-pear etc.&lt;br /&gt;
Test php by using a phpinfo page&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Secure MySQL server&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
Debian (and Ubuntu) MySQL server installation prompts the user to set a password for MySQL root. You can see the corr. dialog in the section MySQL, commented as (set the mysql-root password). So &amp;quot;mysqladmin -u root password &#039;new-password&#039;&amp;quot; thing is obsolete.&lt;br /&gt;
[[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] 01:40, 17 February 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
== PHP modules and phpinfo() ==&lt;br /&gt;
&lt;br /&gt;
Yes, the list of the necessary PHP modules is incomplete.&lt;br /&gt;
&lt;br /&gt;
I want to count them seperately for each Moodle version. The list for 1.9 is there, the others will come as I do a test installation for each version.&lt;br /&gt;
&lt;br /&gt;
Yes, I should add the story of &amp;quot;phpinfo();&amp;quot; single liner. Will do.&lt;br /&gt;
&lt;br /&gt;
Thanks for the feedback.&lt;br /&gt;
[[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] 01:46, 17 February 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Installing_Moodle_on_Debian_based_distributions&amp;diff=95913</id>
		<title>Talk:Installing Moodle on Debian based distributions</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Installing_Moodle_on_Debian_based_distributions&amp;diff=95913"/>
		<updated>2012-02-16T17:40:02Z</updated>

		<summary type="html">&lt;p&gt;Ratna: /* &amp;quot;Secure MySQL server&amp;quot; */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;TODO &lt;br /&gt;
Suggest that the mysql secure utility is used. I refer to it in my Amazon EC2 install page. Copy &amp;amp; paste from there.&lt;br /&gt;
Mention the various extra that need to be installed php-pear etc.&lt;br /&gt;
Test php by using a phpinfo page&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Secure MySQL server&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
Debian (and Ubuntu) MySQL server installation prompts the user to set a password for MySQL root. You can see the corr. dialog in the section MySQL, commented as (set the mysql-root password). So &amp;quot;mysqladmin -u root password &#039;new-password&#039;&amp;quot; thing is obsolete.&lt;br /&gt;
[[User:Visvanath Ratnaweera|Visvanath Ratnaweera]] 01:40, 17 February 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95745</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95745"/>
		<updated>2012-02-11T12:21:41Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;dfn&amp;gt;dsdf&amp;lt;/dfn&amp;gt;dsdfsd&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;/dl&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;First Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Second Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;sdfds sdfsd sdfsd fdsf sdf&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
rtn      pts/4        2012-02-11 13:14 (:0.0)&amp;lt;br /&amp;gt;&lt;br /&gt;
# comment or super user&amp;lt;br /&amp;gt;&lt;br /&gt;
mysql&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;pre&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
rtn      pts/4        2012-02-11 13:14 (:0.0)&lt;br /&gt;
# comment or super user&lt;br /&gt;
mysql&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95744</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95744"/>
		<updated>2012-02-11T12:17:18Z</updated>

		<summary type="html">&lt;p&gt;Ratna: code or pre?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;dfn&amp;gt;dsdf&amp;lt;/dfn&amp;gt;dsdfsd&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;/dl&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;First Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Second Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;sdfds sdfsd sdfsd fdsf sdf&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
rtn      pts/4        2012-02-11 13:14 (:0.0)&amp;lt;br /&amp;gt;&lt;br /&gt;
mysql&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;pre&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
rtn      pts/4        2012-02-11 13:14 (:0.0)&amp;lt;br /&amp;gt;&lt;br /&gt;
mysql&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/p&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95700</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95700"/>
		<updated>2012-02-07T16:47:23Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;dfn&amp;gt;dsdf&amp;lt;/dfn&amp;gt;dsdfsd&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;/dl&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;First Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Second Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;sdfds sdfsd sdfsd fdsf sdf&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
mysql&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95699</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95699"/>
		<updated>2012-02-07T16:37:24Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;dfn&amp;gt;dsdf&amp;lt;/dfn&amp;gt;dsdfsd&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;/dl&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;First Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Second Section&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;sdfds sdfsd sdfsd fdsf sdf&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Subsubsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 mysql&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95686</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95686"/>
		<updated>2012-02-05T15:16:57Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;dfn&amp;gt;dsdf&amp;lt;/dfn&amp;gt;dsdfsd&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;/dl&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Operating System&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Small subsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Web server&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Subsection&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;sdfds sdfsd sdfsd fdsf sdf&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Small subsection&amp;lt;/h4&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
 mysql&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95685</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95685"/>
		<updated>2012-02-05T15:13:17Z</updated>

		<summary type="html">&lt;p&gt;Ratna: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;Top Header&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;dfn&amp;gt;dsdf&amp;lt;/dfn&amp;gt;dsdfsd&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;dsdf&amp;lt;/dt&amp;gt;&lt;br /&gt;
&amp;lt;dd&amp;gt;sdfsdfsdfsd&amp;lt;/dd&amp;gt;&lt;br /&gt;
&amp;lt;/dl&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Operating System&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Subsection&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Small subsection&amp;lt;/h3&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Smaller subsection&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Web server&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Subsection&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Small subsection&amp;lt;/h3&amp;gt; &lt;br /&gt;
  &amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
  mysql&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Smaller subsection&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95684</id>
		<title>User:Visvanath Ratnaweera</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Visvanath_Ratnaweera&amp;diff=95684"/>
		<updated>2012-02-05T11:22:28Z</updated>

		<summary type="html">&lt;p&gt;Ratna: Starting to test MediaWiki HTML compatibility&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;blockquote&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;dsdf&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;cite&amp;gt;Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,&amp;lt;/cite&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Operating System&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Ha ha &amp;lt;abbr&amp;gt;abbr&amp;lt;/abbr&amp;gt; for a &amp;lt;big&amp;gt;biiig&amp;lt;/big&amp;gt; hug.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Subsection&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Small subsection&amp;lt;/h3&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Smaller subsection&amp;lt;/h4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Web server&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Subsection&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Small subsection&amp;lt;/h3&amp;gt; &lt;br /&gt;
  &amp;lt;code&amp;gt;$ &amp;lt;b&amp;gt;who &amp;lt;var&amp;gt;is there&amp;lt;/var&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
  mysql&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h4&amp;gt;Smaller subsection&amp;lt;/h4&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ratna</name></author>
	</entry>
</feed>