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

Support SSH key auth #15

Open
JitteryDoodle opened this issue Nov 16, 2024 · 9 comments
Open

Support SSH key auth #15

JitteryDoodle opened this issue Nov 16, 2024 · 9 comments
Labels
enhancement New feature or request priority-low Low Priority

Comments

@JitteryDoodle
Copy link

JitteryDoodle commented Nov 16, 2024

Is your feature request related to a problem? Please describe.
My server only uses SSH keys and password auth is disabled. Because of this, it's not possible to complete the integration setup.

Describe the solution you'd like
It would be great if SSH key support was added.

Use Case or Why Do You Want This?
Describe a specific scenario where this feature would be helpful or explain why you think it's necessary.
Remove reliance on SSH username and password

Priority of Request
How important is this feature to you?

  • High
  • Medium
  • Low

Additional context
Add any other context or screenshots about the feature request here.

@JitteryDoodle JitteryDoodle added the enhancement New feature or request label Nov 16, 2024
@domalab
Copy link
Owner

domalab commented Nov 16, 2024

Thanks for the request.

I'll add it to my list of improvements to look at.

@domalab domalab added the priority-low Low Priority label Dec 7, 2024
@soricesg
Copy link

soricesg commented Dec 28, 2024

Also interested in using SSH keys rather than password. https://www.youtube.com/watch?v=u2iQACDuoeU if its useful

@domalab
Copy link
Owner

domalab commented Jan 8, 2025

@soricesg @JitteryDoodle I'm currently experimenting with this feature and will let you know if I get this working

@domalab
Copy link
Owner

domalab commented Jan 9, 2025

@JitteryDoodle @soricesg I managed to get it working. Was actually easier than I thought it would be to implement since I am already using pythons ssh library.

Had to change the config flow from single step to multi-step flow that now looks like this.

First Step: Enter Unraid Hostname / IP, username and select authentication method

Screenshot 2025-01-09 at 3 56 24 pm

Second Step: Specify location on HA were key is kept
Screenshot 2025-01-09 at 3 59 27 pm

Last Step: Specify port, UPS and sensor update settings

Screenshot 2025-01-09 at 4 00 53 pm

And the integration is up and running.

Screenshot 2025-01-09 at 4 02 37 pm

I'll add this as a pre-release feature soon and you can try it out

@domalab
Copy link
Owner

domalab commented Jan 10, 2025

@soricesg @JitteryDoodle When you have time feel free to try out the multi-step-auth feature.

  1. Backup and remove the exisiting Unraid integration if using it
  2. Download the source code zip here (Not Release version), extract and copy the unraid folder over to your HA server and restart.
    https://github.com/domalab/ha-unraid/tree/feature/multi-step-auth
  3. Add Unraid integration and follow the steps.

I provided a configuration guide here but I'm sure you know how ssh keys work 😃

https://github.com/domalab/ha-unraid/wiki/Unraid-Integration-Setup-Guide

@soricesg
Copy link

I’m away from my devices for the next week or 2 and don’t want to risk doing anything remotely while I’m away. I’ll absolutely give it a try and any feedback once I’m back home

@l3ztum
Copy link

l3ztum commented Jan 11, 2025

Hi @domalab, wanted to try ssh key auth as well. Followed your steps for manual install and got a error during adding the integration:
Error
"Config flow could not be loaded: {"message":"Invalid handler specified"}"

Home assistant log:
Logger: homeassistant.config_entries
Source: config_entries.py:3314
First occurred: 11:55:40 AM (1 occurrences)
Last logged: 11:55:40 AM
Error occurred loading flow for integration unraid: cannot import name 'CONF_AUTH_METHOD' from 'custom_components.unraid.const' (/config/custom_components/unraid/const.py)

const.py seems to be missing from the commit

after adding these consts with some own random keys the integration works 👍
just tested ssh key auth since i don't want to activate password based authentication

unraid.execute_command seems to fail with the following message:
Failed to perform the action unraid.execute_command. Error executing command: '192.168.178.250'

 action: unraid.execute_command
 data:
   entry_id: 192.168.178.250
   command: ip addr

Unraid (please complete the following information):

Version 7.0.0

Home Assistant (please complete the following information):

Version 2025.1.1

@domalab
Copy link
Owner

domalab commented Jan 12, 2025

Hi @domalab, wanted to try ssh key auth as well. Followed your steps for manual install and got a error during adding the integration: Error "Config flow could not be loaded: {"message":"Invalid handler specified"}"

Home assistant log: Logger: homeassistant.config_entries Source: config_entries.py:3314 First occurred: 11:55:40 AM (1 occurrences) Last logged: 11:55:40 AM Error occurred loading flow for integration unraid: cannot import name 'CONF_AUTH_METHOD' from 'custom_components.unraid.const' (/config/custom_components/unraid/const.py)

const.py seems to be missing from the commit

after adding these consts with some own random keys the integration works 👍 just tested ssh key auth since i don't want to activate password based authentication

unraid.execute_command seems to fail with the following message: Failed to perform the action unraid.execute_command. Error executing command: '192.168.178.250'

 action: unraid.execute_command
 data:
   entry_id: 192.168.178.250
   command: ip addr

Unraid (please complete the following information):

Version 7.0.0

Home Assistant (please complete the following information):

Version 2025.1.1

Thanks for picking up the missing entries in const.py. I re-synced the branch and its now back.

@domalab
Copy link
Owner

domalab commented Jan 12, 2025

@l3ztum Regarding the action: unraid.execute_command failed. Can you please follow this updated wiki article?

https://github.com/domalab/ha-unraid/wiki/How-to-Use-Unraid-Service-Commands

My fault, I forgot to update the article that IP addresses are not supported anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-low Low Priority
Projects
None yet
Development

No branches or pull requests

4 participants