| 146 | |
| 147 | Enable sp site by, |
| 148 | {{{ |
| 149 | a2ensite sp |
| 150 | }}} |
| 151 | |
| 152 | and reload Apache |
| 153 | {{{ |
| 154 | systemctl reload apache2 |
| 155 | }}} |
| 156 | |
| 157 | Install Letsencypt and enable https |
| 158 | {{{ |
| 159 | apt install certbot python3-certbot-apache |
| 160 | certbot --apache |
| 161 | }}} |
| 162 | |
| 163 | Go through the interactive prompt and include your server details. Make sure you select redirect option when asked. |
| 164 | |
| 165 | == Configure Shibboleth SP == |
| 166 | |
| 167 | 11. Download Federation Metadata Signing Certificate: |
| 168 | {{{ |
| 169 | cd /etc/shibboleth/ |
| 170 | wget https://fr.ac.lk/signedmetadata/metadata-signer -O federation-cert.pem |
| 171 | }}} |
| 172 | |
| 173 | 12. Edit shibboleth2.xml opportunely: |
| 174 | |
| 175 | {{{ |
| 176 | nano /etc/shibboleth/shibboleth2.xml |
| 177 | }}} |
| 178 | |
| 179 | {{{ |
| 180 | ... |
| 181 | <ApplicationDefaults entityID="https://sp.YOUR-DOMAIN/shibboleth" |
| 182 | REMOTE_USER="eppn subject-id pairwise-id persistent-id" |
| 183 | cipherSuites="DEFAULT:!EXP:!LOW:!aNULL:!eNULL:!DES:!IDEA:!SEED:!RC4:!3DES:!kRSA:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1"> |
| 184 | ... |
| 185 | <Sessions lifetime="28800" timeout="3600" relayState="ss:mem" checkAddress="false" handlerSSL="true" cookieProps="https"> |
| 186 | ... |
| 187 | <SSO discoveryProtocol="SAMLDS" discoveryURL="https://fds.ac.lk"> |
| 188 | SAML2 |
| 189 | </SSO> |
| 190 | ... |
| 191 | <MetadataProvider type="XML" url="https://fr.ac.lk/signedmetadata/metadata.xml" legacyOrgName="true" backingFilePath="test-metadata.xml" maxRefreshDelay="7200"> |
| 192 | |
| 193 | <MetadataFilter type="Signature" certificate="federation-cert.pem" verifyBackup="false"/> |
| 194 | |
| 195 | <MetadataFilter type="RequireValidUntil" maxValidityInterval="864000" /> |
| 196 | </MetadataProvider> |
| 197 | <!-- Simple file-based resolvers for separate signing/encryption keys. --> |
| 198 | <CredentialResolver type="File" use="signing" |
| 199 | key="sp-signing-key.pem" certificate="sp-signing-cert.pem"/> |
| 200 | <CredentialResolver type="File" use="encryption" |
| 201 | key="sp-encrypt-key.pem" certificate="sp-encrypt-cert.pem"/> |
| 202 | }}} |
| 203 | |
| 204 | 13. Create SP metadata credentials: |
| 205 | {{{ |
| 206 | |
| 207 | /usr/sbin/shib-keygen -n sp-signing -e https://sp.YOUR-DOMAIN/shibboleth |
| 208 | /usr/sbin/shib-keygen -n sp-encrypt -e https://sp.YOUR-DOMAIN/shibboleth |
| 209 | shibd -t /etc/shibboleth/shibboleth2.xml (Check Shibboleth configuration) |
| 210 | |
| 211 | }}} |
| 212 | |
| 213 | 14. Enable Shibboleth Apache2 configuration: |
| 214 | {{{ |
| 215 | |
| 216 | a2enmod shib |
| 217 | systemctl reload apache2.service |
| 218 | }}} |
| 219 | |
| 220 | 15. Now you are able to reach your Shibboleth SP Metadata on: |
| 221 | {{{ |
| 222 | https://sp.YOUR-DOMAIN/Shibboleth.sso/Metadata (change sp.YOUR-DOMAIN to you SP full qualified domain name) |
| 223 | }}} |
| 224 | |
| 225 | 16. Register your SP on LEARN test federation: |
| 226 | |
| 227 | Go to https://liaf.ac.lk/#join and follow the Service provider registration. Once the federation operator approves your request, you will be asked to use the content of your metadata file on federation registry registration. |
| 228 | |
| 229 | You may have to answer several questions describing your service to the federation provider. |
| 230 | |
| 231 | == Configure Moodle as an Federated Resource == |
| 232 | |
| 233 | Here as a prerequisite you need a working moodle installation at the path https://sp.YOUR-DOMAIN/moodle. For this please refer to the link [https://ws.learn.ac.lk/wiki/Csle2022/Agenda/databaseandweb, here]. |
| 234 | |
| 235 | |
| 236 | 17. Create the Apache2 configuration for Moodle: |
| 237 | |
| 238 | {{{ |
| 239 | nano /etc/apache2/sites-available/moodle.conf |
| 240 | }}} |
| 241 | |
| 242 | {{{ |
| 243 | <Location /moodle> |
| 244 | #ShibRequestSetting applicationId mdl |
| 245 | </Location> |
| 246 | |
| 247 | <Directory /var/www/html/moodle/auth/shibboleth/index.php> |
| 248 | AuthType shibboleth |
| 249 | #ShibRequestSetting applicationId mdl |
| 250 | ShibRequireSession On |
| 251 | require valid-user |
| 252 | </Directory> |
| 253 | }}} |
| 254 | |
| 255 | 18. Then enable the site and restart the apache and shibboleth daemon to make changes to effect. |
| 256 | |
| 257 | {{{ |
| 258 | a2ensite secure |
| 259 | |
| 260 | systemctl restart shibd |
| 261 | |
| 262 | systemctl restart apache2 |
| 263 | }}} |
| 264 | |
| 265 | Now you may browse to https://sp.YOUR-DOMAIN/moodle and select your IDP to log in. |