Forum OpenACS Development: Multi Factor Authentication package

MFA (Multi-Factor Authentication) for OpenACS

This package provides Time-based One-Time Password (TOTP) two-factor authentication (2FA) for OpenACS / NaviServer applications, compatible with Google Authenticator and similar apps (Authy, Microsoft Authenticator, FreeOTP, etc.).

It integrates seamlessly into the OpenACS authentication flow and uses the built-in ns_totp command from NaviServer and qrencode CLI via exec.

You can get the code with git clone https://github.com/claudio-48/mfa.git.


🚀 Features

  • Implements TOTP (RFC 6238) using ns_totp
  • User setup with QR code and Base32 secret
  • OTP verification with configurable time window tolerance (skew)
  • The decision to use the 2FA is left to the user, who can opt in and out at any moment
  • Optional enforcement of 2FA for all users (actually not implemented)
  • PostgreSQL schema and setup/verify pages included

Claudio

Collapse
Posted by Brian Fenton on
Congrats, Claudio. This looks super interesting.

Brian

Collapse
Posted by Gustaf Neumann on

Thank you, Claudio! This is a very nice contribution.

I've updated the docker compose instructions for gustafn/openacs:latest to include qrencode:

https://hub.docker.com/repository/docker/gustafn/openacs/general

Collapse
Posted by Claudio Pasolini on
I have implemented the optional enforcement of the MFA for all users.
The package has been tested only with Google Authenticator.

Claudio

Collapse
Posted by Claudio Pasolini on
I just made the last refinements, tested the package also with Authy and updated the repository at https://github.com/claudio-48/mfa.git.

Claudio

Collapse
Posted by Claudio Pasolini on
Added internationalization and moved sql to xql files.
Collapse
Posted by Claudio Pasolini on
The package is now in production in some of our applications. In the first, somewhat naive implementation, OTP authentication was tied to the user, while now it's tied to the session. This way, a user can log in simultaneously on multiple devices, but the OTP is always required.

Claudio