Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pam/gdm): Implement JSON protocol in exec module and use it everywhere #292

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

3v1n0
Copy link
Collaborator

@3v1n0 3v1n0 commented Apr 7, 2024

This is the clean version of using env variables (which are less safe to use) to remember the previously used broker and in general to store the module data consistently.

The good side is that now we can just use everywhere the go-exec + the module and we can drop the code for the wrapper loader (not done here) and not expect different behaviors.

Things works pretty well and are fully tested.

e.g. the alternative to #293.

UDENG-2646

@3v1n0 3v1n0 requested a review from a team as a code owner April 7, 2024 23:34
@3v1n0 3v1n0 force-pushed the binary-exec branch 2 times, most recently from 39cd5ed to c007c7c Compare April 7, 2024 23:54
@3v1n0 3v1n0 marked this pull request as draft April 8, 2024 00:06
@3v1n0 3v1n0 marked this pull request as ready for review April 8, 2024 00:29
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 82.78689% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 85.09%. Comparing base (e181b4d) to head (69f706f).
Report is 4 commits behind head on main.

Files Patch % Lines
pam/integration-tests/cmd/exec-client/client.go 68.75% 5 Missing and 5 partials ⚠️
pam/go-exec/module.c 89.13% 3 Missing and 2 partials ⚠️
pam/pam.go 42.85% 2 Missing and 2 partials ⚠️
pam/main-exec.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #292      +/-   ##
==========================================
+ Coverage   84.48%   85.09%   +0.61%     
==========================================
  Files          72       75       +3     
  Lines        6115     6201      +86     
  Branches       75       72       -3     
==========================================
+ Hits         5166     5277     +111     
+ Misses        662      638      -24     
+ Partials      287      286       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@denisonbarbosa
Copy link
Member

As far as I can see, we can just drop the pam_go_loader anyway, no? We switched to the pam_go_exec already and GDM does not use the loader as well.

@3v1n0
Copy link
Collaborator Author

3v1n0 commented Apr 10, 2024

As far as I can see, we can just drop the pam_go_loader anyway, no? We switched to the pam_go_exec already and GDM does not use the loader as well.

Yeah, exactly... With this branch we could just use the same behavior everywhere, and drop various things... I didn't do it yet since I wasn't sure which was the preferred way, but ideally this is more consistent. Indeed it has some overhead, but from my tests it's not really something noticeable.

@denisonbarbosa
Copy link
Member

This will be superseded by #293, so I'll move it to draft for now.

@denisonbarbosa denisonbarbosa marked this pull request as draft April 10, 2024 15:11
denisonbarbosa added a commit that referenced this pull request Apr 10, 2024
…#293)

In order to be able to read and save the module data in the same way we
should use the very same pam module.

In this case the exec module could be skipped explicitly, but this is
happening anyways implicitly since no data for it will be set, so no
need to add more complexity.

---

This is the simplest alternative to #292 

UDENG-2646
We may want to able to decode the value externally too, so let's make
this more visible
These are exposed as pam.BinaryconvResponse so no internal bit is
actually visible
@3v1n0 3v1n0 force-pushed the binary-exec branch 3 times, most recently from bb55c39 to 065540f Compare April 11, 2024 17:26
@3v1n0
Copy link
Collaborator Author

3v1n0 commented Apr 11, 2024

This will be superseded by #293, so I'll move it to draft for now.

Fair enough, I've rebased and merged it with it so in theory this is still good if we want to drop a bunch of code and duplications

@3v1n0 3v1n0 marked this pull request as ready for review April 11, 2024 17:50
@3v1n0 3v1n0 force-pushed the binary-exec branch 2 times, most recently from ac84d1b to 1895a6d Compare April 11, 2024 23:42
When a binary conversation is requested from the exec, start a JSON
binary conversation with GDM if such protocol is currently supported.

Add tests handling the conversation and all the possible corner cases
…ction in such case

If we're already about to fail because of a timeout don't cleanup the
transaction because we may end up stopping ongoing conversations which
will lead to a panic, without clear explaination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants