-
Notifications
You must be signed in to change notification settings - Fork 21
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
Properly support openPAM #18
Comments
I have looked at it, since we are using this library as well as the wrapper A lot is actually needed to do this. TLDR on all the changed:
I have been looking at fixing these things, since we experienced some problems with Ubuntu/Debian's PAM as well. I created a Are you still willing to work on these crates, or have you moved on to other things? (which is totally understandable and fine) If so, I can submit a PR that addresses most of these issues. The problem being that we cannot use How to actually deal with these differences is also a good question because somewhere the distinction between OpenPAM and Linux PAM needs to be made. I see a couple of possibilities.
I am curious whether you are willing to get involved with this. |
👋 |
Hey @pvdrz, I am not actually sure what the proper way to represent this would be. Take the library with the changes I am proposing. If you want to keep cross-compilation possibilities and not have people need to do build time configuration of a library 5 levels down the dependency tree, it is actually quite difficult. You would like to be able to detect the installed version at compile-time and have something to overwrite that detection to do cross-compilation or linking against a different binary. |
What I was thinking was basically your option of
Where bindings are generated for I'd say that Of course this is easier said than done and I'd be happy to help. |
I feel like this is the best solution, but automatically generating proper bindings will present a problem I fear. The problem is that the target platform alone is not enough. There are BSD systems using Linux-PAM and Linux systems using OpenPAM.
We could detect the installed version at runtime by dynamically linking the library at runtime and seeing whether the |
I'd be very interested in knowing which are those "few Linux distributions" because I did a quick search and got nothing 😅. Same for bsd, the only thing I know is that OpenBSD doesn't use PAM at all. But yeah we could use |
As far as I know, and I have never seen anyone actually do it, some of the Anti-SystemD distributions have the option of using OpenPAM as it is supposedly more "lightweight". It might be fine to use the target platform and have an environment variable to overwrite it if needed. |
yeah I think providing the "natural" default in a simple manner and allowing the user to select whatever they want with env-vars sounds convenient. |
Hey sorry for the late reply! Some thoughts on the matter:
@coastalwhite how should we proceed? I can likely spare some time on this, however likely not before June. Would you be interested in opening a PR to start the discussion? Also, as |
👋 On Regarding the linux-pam vs open-pam issue. I think we agree on just exposing the bindings as they are and leave another crate figure out the differences between both. Am I right? |
Hey! I would love to co-maintain these crates. I will have a look how to use I saw that
I agree. I manually did it in
I have been trying a bit on my own to come up with a better API for PAM clients. Specifically, I wanted to make PAM conversations easier, more secure and more expandable. I have a working prototype which can properly detail with One problem is that I currently don't really deal with modules. I am not sure about that for the moment.
Yes, I would agree with this statement. In general, I will have a look at improving these bindings and then improving the API of the |
Is this the source of truth to figure out the status of this library (and pam) when it comes to OpenPAM support? I want to be able to integrate PAM as part of chipsenkbeil/distant#155 so I can provide alternative authentication when using distant and the associated neovim plugin, distant.nvim. I'm also concerned about 1wilkens/pam#25 leading to segfaults on musl platforms, but I'm assuming that's a pam and not pam-sys issue, though? If not, seems like something to be fixed prior to 1.0 of this sys crate, too! |
Here is the current status of my investigations as of so far. The OpenPAM support is a difficult problem. I got started with the issue, and there are numerous downsides to all solutions. In essence, it is a not a "multiplatform" support problem, but a "multilibrary" support problem. I have tried this in a bunch of different ways, and I have come to the conclusion that having one Separate cratesHave 2 crates: The large problem with this solution. Only a single crate can Single Crate, 2 SubmodulesThis is essentially equivalent to before and solves the However, generating the documentation with Those are the two solutions. The second solution seems the best, so will be focusing on that. I will have a look at doing this in the somewhat near future. It seems as if the ecosystem is already really split on
I feel like PAM is a good target for Rust and that it is important that there is a good FFI library for it. I would love to get the feedback from @1wilkens and @pvdrz. And I hope this provided a status update for @chipsenkbeil. |
@1wilkens @pvdrz any thoughts on this? @coastalwhite has put a lot of work into this and I'd hate to lose the momentum! A single higher-level crate with two separate sys crates has some precedence with wezterm-ssh using ssh2 and libssh-rs, albeit those sub-crates were themselves wrappers on top of the equivalent sys crates. I'm also not opposed to the way that libpam-sys seems to approach it. I'm assuming there's never a situation where OpenPAM and LinuxPAM are both available? If there is, would the former high-level crate with two sys crates be easier? Or would the My first thought from an end-user with a high-level library would be to have a primary export with further modules in the same way that we have |
The problem with I did manage to make quite some progress on what I said in my previous post. I will replace the old PR with a new PR hopefully this weekend. |
I like @coastalwhite first proposal as this is, as mentioned by themselves, a multilibrary issue, they just happen to have the same suffix so we have this blurry notion of PAM in our heads. So I agree, having two different I'm not sure if it should be a I'm not aware of any case where someone wants to use both PAM libraries at the same time so I wouldn't worry that much about the I'm not opposed to the second proposal, the only issue I see is that anyone who wants to do any authentication based on linux without caring about other OSes wouldn't have the option to use something like I'm cc-ing @rnijveld as I think he might have some interesting opinions on this matter. |
Turns out the approach I was attempting with bindgen generating binding for both libraries just does not work. The reason it does not work is quite logical. Since C will not |
Hey all, sorry it took so long for me to come back to this crate (and OSS) in general. I was busy finishing my PhD and had a subsequent job change which really captured all my energy. I have caught up on the the posts here but will probably need another reread to properly disgest the available options. In the meantime I want to thank @coastalwhite for all your investigation and implementation so far! As said in your PR I really would like to get back into things and release a 1.0 version of at least |
How do you also feel about coordinating on this, so that in the future |
Another approach that can be used is to use Platform Specific Dependencies. Maybe, this is the better solution actually |
At the sudo project we try to keep the dependency tree as minimal as possible. I could see the project using this if it were to provide OpenPAM support as well as maintaining bindings for both libraries might be cumbersome. However, that's my personal opinion and other contributors might disagree. |
OpenPAM does not match Linux PAM 100% and thus is not compatible with this library in its current state.
To correctly support openPAM, we should get a comprehensive list of operating systems that use it, match that with the ones Rust builds for and properly handle API differences in a uniform way.
The text was updated successfully, but these errors were encountered: