-
Notifications
You must be signed in to change notification settings - Fork 210
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
Implement/extend transport plugin to support authentication by password while not recommending it #6642
Comments
I think it would be better to not put in the |
I can arrange this in |
Was come from #6688 (comment) Some idea, hope it is helpful. There is a I think this linux tool can provide what we need to build a relatively safe plugin that solve the issue.
|
After some research, I think it is doable. For the tool side, since our user are mainly linux and apple, we can limit this functionality to these two platform at the moment.
Therefore, we need @agoscinski @khsrali what do you think? |
Thanks @unkcpz . Indeed using a keymanager is the best solution for this. P.S. Now that I read this issue again: It's not clear if it even possible at all. No python package currently support it. |
The OP is a different issue, and Sigma2 is a Norwegian HPC clusters. You can open another issue for that, this issue is specifically about an authentication by password.
@mbercx @agoscinski who is the contact person you know that has this use case? Is the description from this issue complete? Can we (do we need) get more specific use case of it? If it requires just username and password it also makes a lot sense (from the description of this issue, it is.) |
The use case is this: provided a distant ssh enabled machine, not providing key authentication, not port forwarding, make aiida work correctly. The OS is RHEL 8/9. you are not root. You can't expect whatever software to be installed on the login nodes (it's not the far west and there are security implications for more things that I would like..). You can get a feel for the environment by reading through: https://dci.dci-gitlab.cines.fr/webextranet/index.html, https://www-hpc.cea.fr/tgcc-public/en/html/tgcc-public.html AFAIK, there are no relevant additional constraints. |
@etiennemlb, Thanks for your comment. However I don't understand. Please be more descriptive and provide a clear and step by step procedure that how you are connecting to your server.
I don't understand what you mean by that, sorry. 💁
You are not supposed to install aiida on the server, you should install it on your local machine, if that's what you mean.
To save time, please send an exact link to the exact login procedure, |
I believe this means the remote HPC or super computer center.
I also struggle to find where in the documentation it mentioned password only login. @etiennemlb could you point to the link? I think anyway this is a fair use case and provide such functionality would help for onboarding new user, since set up a key pair for passwordless login is not always trivial if user never did it. The difficulties for us is how to make computer setup interface consistent with the one require private key. Will discuss this on biweekly meeting.
This part is easy, I had something work already ;) |
Distant, meaning the machine is not somewhere in your garage, you do not have access to it, so no assumption about your ability to fix it should be taken. A very small amount of requirement (of which I do not know exactly the extent) should be made about the target machine (assume RHEL8/9). The point is not that you should install Aiida or not, the point is that you can't, again, change things on the machine. You can touch the configuration of the ssh daemon for instance. You can't enable ssh port forwarding if not already enabled etc etc. For the login procedure, it's very classical, except that no ssh key is usable for authentication: |
@etiennemlb ok, then all the information that you are actually trying to "add" to this issue is: No nasty language is required to say something as simple as that. Basics about AiiDA: |
I did some prototyping using
Technical details to keep in mind for implementation:
|
thanks for checking @agoscinski
I aware of
I public the draft repo where I wrap keyring-rs that has keyctl support and seems not have macOS memory issue. Could you give it a try on your mac? https://pypi.org/project/keyringrs/
I was thinking this should be a prompt when setup computer and at the same time provide a command to setup the password separately. Can be
Why not ;) I am not always against inheritance, especially it is just prototype. |
I just understood my issue. It was because I used two different terminal panes and in the one I tested the verdi command I was ssh'ed into localhost. When you are ssh'ed you do not have permissions to access the keychain. The keyringrs also works.
I mean paramiko is supporting passwords, so we can pass the password to the I am not sure if it should be separate transport or extend ssh, both would be possible and seems to be only an UI question. It depends what the goal |
Sure we can trust it to handle password. The problem I don't have answer in head is how to pass password to client.connet, how we support both password and private key? How we prompt to ask user to give input and how we update orm model to store the key name, and what is the lifetime of the password. It is only a ui question but to me it is a difficult one.
Good point, I never think about gotocomputer command. But I don't get why sshpass is needed? |
paramiko supports it https://docs.paramiko.org/en/latest/api/client.html Worked when I tried.
Yes this is the open UI question to me. If we want to merge it into one or keep it separate. We should discuss with @khsrali
In click you can specify 'password',
{
'type': str,
'prompt': 'Password',
'hide_input': True,
'help': 'Login password for the remote machine.',
'non_interactive_default': True,
},
I am not sure if this covers all cases, but we could hook into the auth params in def get_auth_params(self) -> Dict[str, Any]:
auth_params = self._backend_entity.get_auth_params()
if password := auth_params.get("password", None):
from keyrings import Entry
from aiida.manage import get_manager
username = auth_params['username']
profile = get_manager().get_profile().name
auth_params['password'] = Entry(f"aiida-{profile}", f"{username}").get_password()
return auth_params
def set_auth_params(self, auth_params: Dict[str, Any]) -> None:
if password := auth_params.get("password", None):
from keyrings import Entry
from aiida.manage import get_manager
username = auth_params['username']
profile = get_manager().get_profile().name
Entry(f"aiida-{profile}", f"{username}").set_password(auth_params['password'])
auth_params['password'] = True
self._backend_entity.set_auth_params(auth_params)
Until the computer or profile is deleted.
With ssh you cannot pass the password in the command so a prompt will appear. I guess that would be okay for that command, but if we could just use the stored password in a save way, it would be more convenient for the user. I guess if we do |
@unkcpz @khsrali had a small discussion. These are the main points:
|
I think the |
Good to know, I think this is a good way for gotocomputer command.
This is exact reason I was investigating the But I slightly change my perspective and think the process space key accessing is not necessary. If the key is set to user space it is fine. If the user installed any malicious app that will try to explore the keychains, the ssh password is just one of many important keys the hacker want to get. |
that's a good point, actually 🤔 @unkcpz can you update keyringrs/ so that it would verify the client as well? password = entry.set_password(<PASS>, ['transport.py']) The only downside is that when a user updates their aiida installation, they may need to reauthorize, or re-configure their aiida computer. |
And I think it is not able to solve the problem, when using keyring (no matter the python one or the one I wrapped), the keys are set in the user level by default. |
Not sure if it is still relevant, but I believe it was (French) Gabriel from EPFL who is now working at a French institution. Let me know if I should reach out to ask more details. |
Thanks @mbercx. I think soon @agoscinski will have something work and ready for test, we can reach out then. |
Is your feature request related to a problem? Please describe
A number of French HPCs only allow an authentication by password. By modern safety standards this is considered as not safe but it is current state for a lot of HPCs (merde!) so we should support it while not recommending it. Since this is a large user bases I marked it as important.
Describe the solution you'd like
Implement a transport plugin or extend the current transport to also support ssh connections authenticated by password.
The text was updated successfully, but these errors were encountered: