Commit Graph

6 Commits

Author SHA1 Message Date
Lars Scheibling c1a0f72fa1 Updated path 2024-01-12 09:20:18 +00:00
Marco Trevisan (Treviño) ac879208ea module-transaction: Add support for binary conversations
A module can now initiate a binary conversation decoding the native
pointer value as it wants.

Added tests to verify the main cases
2023-12-14 22:07:50 +01:00
Marco Trevisan (Treviño) 883dc86533 module-transaction: Add support for initiating PAM Conversations
Modules have the ability to start PAM conversations, so while the
transaction code can handle them we did not have a way to init them.
Yet.

So add some APIs allowing this, making it easier from the go side to
handle the conversations.

In this commit we only support text-based conversations, but code is
designed with the idea of supporting binary cases too.

Added the integration tests using the module that is now able to both
start conversation and handle them using Go only.
2023-12-14 22:07:50 +01:00
Marco Trevisan (Treviño) 449b2672b9 module-transaction: Add GetUser() method that prompts an user if non-set
We can now finally test this properly both using a mock and through the
interactive module that will do the request for us in various conditions.
2023-12-14 22:07:50 +01:00
Marco Trevisan (Treviño) c1b7ee1623 tests: Add a module implementation with dynamic control from the app
In order to properly test the interaction of a module transaction from
the application point of view, we need to perform operation in the
module and ensure that the expected values are returned and handled

In order to do this, without using the PAM apis that we want to test,
use a simple trick:
 - Create an application that works as server using an unix socket
 - Create a module that connects to it
 - Pass the socket to the module via the module service file arguments
 - Add some basic protocol that allows the application to send a request
   and to the module to reply to that.
 - Use reflection and serialization to automatically call module methods
   and return the values to the application where we do the check
2023-12-14 22:07:50 +01:00
Marco Trevisan (Treviño) 8c30b5946a pam-moduler: Add test that generates a new debug module and verify it works
We mimic what pam_debug.so does by default, by implementing a similar
module fully in go, generated using pam-moduler.

This requires various utilities to generate the module and run the tests
that are in a separate internal modules so that it can be shared between
multiple implementations
2023-12-14 22:07:50 +01:00