🆕[add-on] HassOS SSH port 22222 Configurator

You can always transform the key or generate a new one. What was the key type? What did it start with?

well i made a key using Puttygen and used it after on my mac
using key generated on my mac didnt work for some reason, i used several tutorials and official docs to do that
all worked well, but it surely took some time to do that, had issues afterward using that ssh key to mount nas samba drive for frigate and got errors of Too open key, could not chmod that key because the file system is read only.

Would you have found it useful if there was an additional switch in settings:

Disregard the above, generate a new key and print it in the logs.

This would go below the existing SSHKey box
image
As seen in this picture of my Active Cooling addon.

I’m trying to figure out how to make this process easier.

Hello there - wanted to edit config.txt on my Home Assistant Yellow - seemed like your addon should do the trick. But I cannot get to install it. I get whole list errors:

23-03-31 14:44:13 WARNING (SyncWorker_0) [supervisor.addons.validate] Add-on have full device access, and selective device access in the configuration. Please report this to the maintainer of DeskPi Pro Active Cooling
23-03-31 14:44:13 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 185, in block_bad_requests
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 201, in system_validation
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 268, in token_validation
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 280, in core_proxy
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/utils.py", line 62, in wrap_api
    answer = await method(api, *args, **kwargs)
  File "/usr/src/supervisor/supervisor/api/store.py", line 178, in store_info
    ATTR_ADDONS: [
  File "/usr/src/supervisor/supervisor/api/store.py", line 179, in <listcomp>
    self._generate_addon_information(self.sys_addons.store[addon])
  File "/usr/src/supervisor/supervisor/api/store.py", line 114, in _generate_addon_information
    ATTR_ADVANCED: addon.advanced,
  File "/usr/src/supervisor/supervisor/addons/model.py", line 227, in advanced
    return self.data[ATTR_ADVANCED]
  File "/usr/src/supervisor/supervisor/store/addon.py", line 19, in data
    return self.sys_store.data.addons[self.slug]
KeyError: 'a0d7b954_grocy'
23-03-31 14:44:13 WARNING (SyncWorker_3) [supervisor.addons.validate] Add-on have full device access, and selective device access in the configuration. Please report this to the maintainer of DeskPi Pro Active Cooling
23-03-31 14:44:13 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 185, in block_bad_requests
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 201, in system_validation
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 268, in token_validation
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 280, in core_proxy
    return await handler(request)
  File "/usr/src/supervisor/supervisor/api/utils.py", line 62, in wrap_api
    answer = await method(api, *args, **kwargs)
  File "/usr/src/supervisor/supervisor/api/store.py", line 178, in store_info
    ATTR_ADDONS: [
  File "/usr/src/supervisor/supervisor/api/store.py", line 179, in <listcomp>
    self._generate_addon_information(self.sys_addons.store[addon])
  File "/usr/src/supervisor/supervisor/api/store.py", line 114, in _generate_addon_information
    ATTR_ADVANCED: addon.advanced,
  File "/usr/src/supervisor/supervisor/addons/model.py", line 227, in advanced
    return self.data[ATTR_ADVANCED]
  File "/usr/src/supervisor/supervisor/store/addon.py", line 19, in data
    return self.sys_store.data.addons[self.slug]
KeyError: 'a0d7b954_emqx'

Not sure how to fix that… In the UI it only says: Failed to install addon - unknown error

Disable protection mode.

Hello @adamoutler ,

can i use you add-on with Virtualbox haos_ova-9.5.vdi.zip ?

My problem: - ssh connection - haos_ova-9.5.vdi -

Thank’s, i have solved my problem.

The instructions for this are not clear.

Use ssh-keygen to create your key

paste the key into the config tab and save.

Disable protection mode

start the addon and then reboot twice (im running a VM in proxmox)?

Then enter ssh [email protected] -p22222 into the HA SSH addon?

I get; ssh: connect to host 127.0.0.1 port 22222: Connection refused

Do I restart it after the reboot?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
no vda1 config found
creating authorized keys in sda1 !
no sdb1 config found
no mmcblk0p1 config found
no mmcblk1p1 config found
no nvme0n1p1 config found
This Configurator did it's job. Perform a hard-power-off now. This configurator only works once and is no longer needed.

I Just did it all again and get the same error.

Can I use the SSH HA addon?

It should work. Did you power off the VM?

I was rebooting the VM though proxmox. I just went though it again

ssh-keygen to create your key form within the SSH HA addon?

paste the key.pub (I named it key when asked) into the config tab and save.

image

That’s how it looks after saving.

protection mode disabled

start the addon, then shutdown the VM in the Poxmox console

Start the VM

Using the SSH addon for HA enter;

[core-ssh ~]$ ssh -vv  [email protected] -p22222
OpenSSH_9.0p1, OpenSSL 1.1.1q  5 Jul 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 127.0.0.1 is address
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22222.
debug1: connect to address 127.0.0.1 port 22222: Connection refused
ssh: connect to host 127.0.0.1 port 22222: Connection refused
[core-ssh ~]$ ls
addons  backup  config  share   ssl
[core-ssh ~]$ 

Also the key and key.pub disappears after a restart?

This is untested with VM. Have you tried other options?

Thanks for trying to help I appreciate it.

Its just so frustrating when HA are breaking things all the time that are NOT in breaking changes, then we are just expected to wait a month or two before they PR the fix because we cant edit the code of an open source platform.

Anyway, thanks for trying to help. I appreciate it

Are you trying to edit the code of an integration? You don’t need this to do that.

It is off topic, so start a new thread and tag me in.

1 Like
6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
no vda1 config found
creating authorized keys in sda1 !
no sdb1 config found
no mmcblk0p1 config found
no mmcblk1p1 config found
no nvme0n1p1 config found
This Configurator did it's job. Perform a hard-power-off now. This configurator only works once and is no longer needed.

this is my log but I can’t access port 22222

Try with a different key

I have tried with using puttygen generated key, ssh-keygen in ssh-addon, ssh-keygen in windows but issue still remains.

all result in the same

ssh: connect to host 192.168.18.200 port 22222: Connection refused

and

ssh 127.0.0.1  -p22222
ssh: connect to host 127.0.0.1 port 22222: Connection refused

this method worked after so many tries

Tell me… would it be helpful if I add a check box boolean Disregard entered key and generate a new one

This checkbox would perform the following actions:

  1. Generate a key
  2. Store the key in the /config/addon-22222/ folder

The general flow would be modified to:

  1. If key exists use it otherwise use entered key.
  2. Notify user this is occurring via logs.
  3. Upon completion, provide instructions on where to find the key, how to delete the key, and how to log in from Terminal app.
4 Likes

To make this work do I have to do a full hardware poweroff or should a proper host reboot be enough? I try to SSH from localhost SSH to the localport 22222 and I have tried also to generate a new key but to no avail. Just wondering if the problem is that I need to poweroff - but I have no physical access.

Yes please.
I run HAOS in a VM on TrueNAS Scale, so this will make it easier.

Question too please; does this addon provide a way to mount a remote Samba share to the underlying OS so it can be used by other addons? My use cases are Logitech Media Server playing music from TrueNAS and AA CCTV addon saving video to a share.

Full reboot. It can be done from the WebUI in HAOS.