PhDLeToanThang / mooc

MOOC version 4 by moodle v4.x
MIT License
0 stars 0 forks source link

Multi-factor authentication làm cấu hình Plugin cho Moodle 3x/4x #3

Closed PhDLeToanThang closed 6 days ago

PhDLeToanThang commented 6 days ago

This is a Moodle plugin which adds Multi-Factor authentication (MFA), also known as Two-factor authentication (2FA) on top of your existing chosen authentication plugins. https://en.wikipedia.org/wiki/Multi-factor_authentication

This is a Moodle plugin which adds Multi-Factor authentication (MFA), also known as Two-factor authentication (2FA) on top of your existing chosen authentication plugins.

https://en.wikipedia.org/wiki/Multi-factor_authentication

Why another MFA plugin for Moodle? There are other 2FA plugins for moodle such as:

https://moodle.org/plugins/auth_a2fa

This one is different because it is NOT a Moodle authentication plugin. It leverages new API's that Catalyst specifically implemented in Moodle Core to enable plugins to augment the login process instead of replacing it. This means that this MFA plugin can be added on top of any other authentication plugin resulting in a much cleaner architecture, and it means you can compose a solution that does everything you need instead of compromising by swapping out the entire login flow.

See this tracker and the dev docs for more info:

https://tracker.moodle.org/browse/MDL-66173

https://docs.moodle.org/dev/Login_callbacks

The other major difference is that we support multiple authentication factor types as sub plugins, eg IP Range, Email, TOTP, WebAuthn / FIDO2 and in future others such as SMS or hardware tokens or anything else as new sub-plugins. They can be flexible configured so that different combinations of factors are considered enough.

Flexible configuration The MFA has multiple sub-plugins for each type of factor. Different factors can be combined and checked in a specific order. See the plugin readme for the full details:

https://github.com/catalyst/moodle-tool_mfa/#configuration

For more information, consult the readme:

https://github.com/catalyst/moodle-tool_mfa/

Warm thanks Thanks to Swissbit for sponsoring the work to add WebAuthn / FIDO2 support to this plugin.

image

image

image

image

image

image

PhDLeToanThang commented 6 days ago

Current versions 2023080100 (2023080100) Moodle 4.0, 4.1, 4.2 Released: Thursday, August 3, 2023, 9:02 AM https://moodle.org/plugins/download.php/29731/tool_mfa_moodle42_2023080100.zip

2023031600 (2023031600) Moodle 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 4.0, 4.1 Released: Thursday, March 16, 2023, 1:30 PM

https://moodle.org/plugins/download.php/28743/tool_mfa_moodle41_2023031600.zip

PhDLeToanThang commented 6 days ago

Tham khảo mô hình oAuth của MS viết gói Moodle-auth_oidc

https://github.com/Microsoft/moodle-auth_oidc

Microsoft 365 and Microsoft Entra ID Plugins for Moodle OpenID Connect Authentication Plugin. The OpenID Connect plugin provides single-sign-on functionality using configurable identity providers.

This is part of the suite of Microsoft 365 plugins for Moodle.

This repository is updated with stable releases. To follow active development, see: https://github.com/Microsoft/o365-moodle

Installation Unpack the plugin into /auth/oidc within your Moodle install. From the Moodle Administration block, expand Site Administration and click "Notifications". Follow the on-screen instuctions to install the plugin. To configure the plugin, from the Moodle Administration block, go to Site Administration > Plugins > Authentication > Manage Authentication. Click the icon to enable the plugin, then visit the settings page to configure the plugin. Follow the directions below each setting. For more documentation, visit https://docs.moodle.org/34/en/Office365

For more information including support and instructions on how to contribute, please see: https://github.com/Microsoft/o365-moodle/blob/master/README.md

Issues and Contributing Please post issues for this plugin to: https://github.com/Microsoft/o365-moodle/issues/ Pull requests for this plugin should be submitted against our main repository: https://github.com/Microsoft/o365-moodle

Copyright © Microsoft, Inc. Code for this plugin is licensed under the GPLv3 license.

PhDLeToanThang commented 6 days ago

Trong ubuntu and mariadb, lệnh gì để hiển thị các danh sách các users:

Trong MariaDB trên Ubuntu, bạn có thể sử dụng câu lệnh SQL để xem danh sách các người dùng hiện có trong cơ sở dữ liệu. Dưới đây là cách để hiển thị danh sách các người dùng trong MariaDB:

  1. Đăng nhập vào MariaDB: Trước tiên, mở Terminal và đăng nhập vào MariaDB bằng tài khoản có đủ quyền để xem danh sách người dùng. Sử dụng lệnh sau và nhập mật khẩu khi được yêu cầu:

    mysql -u username -p
  2. Sử dụng lệnh SQL để hiển thị danh sách người dùng: Dùng câu lệnh SQL sau để xem danh sách các người dùng trong MariaDB:

    SELECT User, Host FROM mysql.user;

    Lệnh trên sẽ trả về một bảng hiển thị tên người dùng và host mà họ được phép truy cập.

  3. Thoát khỏi MariaDB (nếu cần): Sau khi xem xong danh sách người dùng, bạn có thể thoát khỏi MariaDB bằng cách gõ:

    exit;

Lưu ý rằng để chạy các lệnh trên, bạn cần có quyền truy cập để truy cập vào cơ sở dữ liệu MariaDB và xem thông tin về người dùng. Hãy thay thế username bằng tên người dùng thực tế trong hệ thống của bạn.

PhDLeToanThang commented 6 days ago

The issue that Catalyst should address is changing the text string factor_totp/settings:totplink_help with the default value "If enabled the user will see a 3rd setup option with a direct otpauth:// link".

This text should be changed to "If enabled the user will see a 3rd setup option with a direct otpauth:// link. The QR setup code can be found in the user's Preferences page at /user/preferences.php".

The plugin settings page does not make it clear that the auth app set up lives under Preferences for the user.

image

User setup If you enable the factors Authenticator app and Security key, your users will need to configure multi-factor authentication themselves. The authentication settings can be accessed through User menu > Preferences > Multi-factor authentication preferences. There, they will be able to set up and see their authenticator apps or security keys, as well as revoke access to any factors they have configured.

image

--> https://moodle school url/user/preferences.php

image

Next step: configure App for user

image

Of course before that, On your Smartphone / ipad / iphone you must download and install one (01) of the following Authentication Apps:

  1. Twilio Authy or
  2. Microsoft Authenticator or
  3. Google Authenticator for iOS or Android

image

If you have a Smartphone and App ready, you can click "SETUP APP" button to next:

image

image