-
Notifications
You must be signed in to change notification settings - Fork 174
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
Support multiple credentials for shell and ssh #1291
Conversation
Add support for trying different credentials to authenticate. username and password can be lists of strings that are tried in turn to log in. Signed-off-by: Nicolas Labriet <[email protected]>
Add support for trying different credentials to authenticate. username and password can be lists of strings that are tried in turn to log in. Signed-off-by: Nicolas Labriet <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1291 +/- ##
========================================
- Coverage 63.0% 62.9% -0.1%
========================================
Files 160 160
Lines 11901 11920 +19
========================================
+ Hits 7502 7507 +5
- Misses 4399 4413 +14
☔ View full report in Codecov by Sentry. |
Thanks for thinking about contributing. We had several discussions about "generic environment configurations" recently. My perspective is: The environment configuration is intended to be DUT-specific (including software). If username/password are different, you need a different configuration. The same applies to cases like "different bootloader", "different prompt" etc. The situation is different when you connect multiple identical DUTs, but your infrastructure is different, e.g. another power switch is used requiring a different driver in the environment config. For these cases, we think that an environment config managed by the coordinator might be a valid approach. Changing this place-specific, central config could be done via labgrid-client. A local config could still be used, both would be merged as long as they do not conflict. So I don't think that this change is something that we want to merge into labgrid. What do you think, @Emantor, @jluebbe? |
Thank you for your feedback. But I think the By the way, why keep SSH and console credentials separate? My PR is meant to highlight and easy my use case, but I could probably manage another way (yaml anchors are great in the environment file). |
If the address should come from the infrastructure (i.e. via a SNMPEthernetPort), you can use a NetworkService with a placeholder address and update it during runtime with this information.
|
The address is provided by the exporter and will always be the same for a given place. What about adding Since SSHDriver is in the environment file, credentials could then be completely managed by the environment file. |
Description
Add support for having a list of usernames and passwords to try to connect with.
This touches
shelldriver
,networkservice
andsshdriver
.Depending on the software provisioned on a place, credentials may be different. It's my case where 3 different credentials are needed (user1/pass1 user2/pass2 user3/pass3) when soft1 or soft2 or soft3 is on the target.
In order not to have to change the LabGrid configuration (and the exporter as
networkservice
holds the IP and credentials for ssh) I can up with this PR.The credentials are tried in turn and I don't get a timeout with 3 credentials. More credentials will probably need a timeout tweak or a way to configure it.
I have manually tested login in with
console
,ssh
, and-s shell ssh
, I have also tested sending a file withscp
.This also enable a smoother test experience. My tests can now use the same configuration for all software.
Checklist