323 | | a2ensite lms-ssl.conf |
| 324 | a2ensite lms.YOUR-DOMAIN-ssl.conf |
| 325 | |
| 326 | Also create SSL site configuration file for Wordpress site too. |
| 327 | |
| 328 | nano wp.YOUR-DOMAIN-ssl.conf |
| 329 | |
| 330 | <IfModule mod_ssl.c> |
| 331 | <VirtualHost *:443> |
| 332 | |
| 333 | ServerName wp.YOUR-DOMAIN |
| 334 | ServerAdmin you@YOUR-DOMAIN |
| 335 | DocumentRoot /var/www/wp.YOUR-DOMAIN/public_html |
| 336 | |
| 337 | ErrorLog ${APACHE_LOG_DIR}/wp-error.log |
| 338 | CustomLog ${APACHE_LOG_DIR}/wp-access.log combined |
| 339 | |
| 340 | |
| 341 | SSLCertificateFile /etc/ssl/certs/ssl-lms.crt |
| 342 | SSLCertificateKeyFile /etc/ssl/private/ssl-lms.key |
| 343 | |
| 344 | RewriteEngine on |
| 345 | RewriteCond %{SERVER_NAME} =wp.YOUR-DOMAIN |
| 346 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] # port 80 -- > 443 redirection |
| 347 | </VirtualHost> |
| 348 | </IfModule> |
| 349 | |
| 350 | a2ensite wp.YOUR-DOMAIN-ssl.conf |
| 436 | |
| 437 | === Enable Shibboleth on apache virtual hosts === |
| 438 | |
| 439 | <IfModule mod_ssl.c> |
| 440 | <VirtualHost *:443> |
| 441 | |
| 442 | ServerName lms.YOUR-DOMAIN |
| 443 | ServerAdmin you@YOUR-DOMAIN |
| 444 | DocumentRoot /var/www/lms.YOUR-DOMAIN/public_html |
| 445 | |
| 446 | ErrorLog ${APACHE_LOG_DIR}/lms-error.log |
| 447 | CustomLog ${APACHE_LOG_DIR}/lms-access.log combined |
| 448 | |
| 449 | |
| 450 | SSLCertificateFile /etc/ssl/certs/ssl-lms.crt |
| 451 | SSLCertificateKeyFile /etc/ssl/private/ssl-lms.key |
| 452 | |
| 453 | <Location /moodle> |
| 454 | #ShibRequestSetting applicationId mdl |
| 455 | </Location> |
| 456 | |
| 457 | <Directory /var/www/html/moodle/auth/shibboleth/index.php> |
| 458 | AuthType shibboleth |
| 459 | #ShibRequestSetting applicationId mdl |
| 460 | ShibRequireSession On |
| 461 | require valid-user |
| 462 | </Directory> |
| 463 | </VirtualHost> |
| 464 | </IfModule> |
| 465 | |
| 466 | nano wp.YOUR-DOMAIN-ssl.conf |
| 467 | |
| 468 | <IfModule mod_ssl.c> |
| 469 | <VirtualHost *:443> |
| 470 | |
| 471 | ServerName wp.YOUR-DOMAIN |
| 472 | ServerAdmin you@YOUR-DOMAIN |
| 473 | DocumentRoot /var/www/wp.YOUR-DOMAIN/public_html |
| 474 | |
| 475 | ErrorLog ${APACHE_LOG_DIR}/wp-error.log |
| 476 | CustomLog ${APACHE_LOG_DIR}/wp-access.log combined |
| 477 | |
| 478 | |
| 479 | SSLCertificateFile /etc/ssl/certs/ssl-lms.crt |
| 480 | SSLCertificateKeyFile /etc/ssl/private/ssl-lms.key |
| 481 | |
| 482 | <Location /> |
| 483 | AuthType Shibboleth |
| 484 | ShibRequestSetting requireSession false |
| 485 | Require shibboleth |
| 486 | </Location> |
| 487 | #Wordpress shibboleth plugin needs requireSession to be false |
| 488 | </VirtualHost> |
| 489 | </IfModule> |
424 | | == Configure Moodle as an Federated Resource == |
425 | | |
426 | | 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]. |
| 514 | == Enabling Wordpress plugin == |
| 515 | |
| 516 | Install and activate the shibboleth plugin by Michael !McNeill, mitcho (Michael 芳貴 Erlewine), Will Norris {{{ https://wordpress.org/plugins/shibboleth/ }}} |
| 517 | |
| 518 | Then go to '''Settings''' -> '''Shibboleth''' |
| 519 | |
| 520 | |
| 521 | On General Tab: |
| 522 | |
| 523 | Login URL: {{{ https://wp.YOUR-DOMAIN/Shibboleth.sso/Login }}} |
| 524 | |
| 525 | Logout URL: {{{ https://wp.YOUR-DOMAIN/Shibboleth.sso/Logout }}} |
| 526 | |
| 527 | Attribute Access: Environment Variables |
| 528 | |
| 529 | |
| 530 | On User Tab: |
| 531 | |
| 532 | Tick Automatically Create Accounts. |
| 533 | Check the attribute map as well. If you ticked any attribute Manage tick, user will not be able to change the values once they logged in. |
| 534 | |
| 535 | |
| 536 | On Authorization Tab: |
| 537 | |
| 538 | Select Subscriber as the Default Role. |
| 539 | |
| 540 | |
| 541 | On Logging Tab: |
| 542 | |
| 543 | Enable all Logging. |
| 544 | |
| 545 | |
| 546 | |
| 547 | Click Save. |
| 548 | |
| 549 | |
| 550 | == Enabling Moodle Plugin == |
| 551 | |
| 552 | As Moodle admin, go to the '''Site administration''' >>> '''Plugins''' >>> '''Authentication''' and click on the '''Shibboleth''' enable '''eye'''. Next go to its settings. |
| 553 | |
| 554 | |
| 555 | Fill in the fields of the form. |
| 556 | |
| 557 | The fields 'Username', 'First name', 'Surname', 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 'Username' field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users. |
| 558 | |
| 559 | Username: eppn |
| 560 | |
| 561 | Moodle WAYF service: No |
| 562 | |
| 563 | Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout |
| 564 | |
| 565 | Data mapping (First name): givenName |
| 566 | |
| 567 | Data mapping (Surname): surname |
| 568 | |
| 569 | Data mapping (Email address): mail |
| 570 | |
| 571 | Update local (Email address): On Creation |
| 572 | |
| 573 | Lock value (Email address): Locked |
| 574 | |
| 575 | |
| 576 | Click Save. |
| 577 | |
| 578 | |
| 579 | Now using a private browser, try to log in to both systems using your IDP test user. |