blog.plee.me About software, technology and random things

3May/200

Uploading a Snapshot to a Fresh Home Assistant OS Instance

Hi!

After finding that my previously running Home Assistant OS instance was no longer working let alone starting properly, I decided to wipe it and simply install from a fresh image today. In order to pick up where I left off, I wanted to restore from a snapshot that I made a short while ago.

Out of the box, Home Assistant OS does not seem to come with any way to upload snapshots (or any other kind of files) onto the instance. Usually, this would not be a problem, because I had previously used the Samba share add-on from the official add-on repository, but since updating it to the new repository website, the Samba share add-on seems to have disappeared.

My first alternate approach using the SSH access did not work either, as I could not use SFTP because it is not effectively using proper SSH/SFTP but an intermediate wrapper for the Home Assistant console.

The quickest way I found that had minimal impact on the system in terms of creating a mess was to use Docker and download my latest snapshot from a web server hosted somewhere else via cURL. In this case I was using a self-hosted Nextcloud instance with a shared file link, but your mileage may of course vary.

Prerequisites / Assumptions

  1. You are using the Home Assistant OS official image on a device in headless mode, so you have a minimal system without neat tools like curl or wget pre-installed.
  2. You have uploaded the snapshot file to a web server that is accessible from the Home Assistant OS system (in terms of network connectivity).

Steps

  1. Enable SSH access by following the official documentation on how to enable SSH access to the host.
    • Update from 2020-05-21: They seem to have restructured the documentation and the original instructions are no longer on that page. It used to say:
      Use a USB drive formatted with FAT, ext4, or NTFS and name it CONFIG (case sensitive). Create an "authorized_keys" file (no extension) containing your public key, and place it in the root of the USB drive. File needs to be ANSI encoded (not UTF-8) and must have Unix line ends (LF), not Windows (CR LF). [...] From the UI, navigate to the Supervisor system page and choose "Import from USB". You can now access your device as root over SSH on port 22222. Alternatively, the file will be imported from the USB when the Home Assistant OS device is rebooted.
  2. Log into the Home Assistance OS instance via SSH.
  3. Type the command "login" to enter the actual shell.
  4. Use the following command to download the snapshot file:
    docker run --rm curlimages/curl https://my.server.local/a1b2c3d4.tar > /mnt/data/supervisor/backup/a1b2c3d4.tar
    (Change URL and file names of course. The destination directory should be fine.)
  5. You might want to check file integrity for the file via md5sum or sha512sum etc.
  6. If you want to be extra tidy, you can remove the cURL Docker image again by executing
    docker image rm curlimages/curl
  7. Close the SSH session and open a new one.
  8. Do not enter the actual shell but instead execute this command to get Home Assistant to notice the newly uploaded snapshot:
    snapshots reload
  9. Now log into the Home Assistant web interface or just keep using the console and restore what you need.
  10. Done!

I hope this saved you a bunch of research because I myself could not find anything quick and practical on this topic.

Thanks for reading!

18Jan/170

PhonerLite With FRITZ!Box

Hello!

If you want to set up your PhonerLite VoIP/SIP client with the FRITZ!Box so you can receive phone calls on your computer as well, of course you should have a look at the official AVM documentation (like the one for the FRITZ!Box 7390).

However, I encountered the following problems:

  • outgoing calls would result in a "480 Temporarily Unavailable" error (even the test number **797)
  • saving the configuration (tab "Configuration" => "Save" button) repeatedly would cause the status bar to alternate between
    • showing a red indicator and the error message "sip:<number>@fritz.box not registered <Connectivity Checks Failed>" every second click
    • showing a green indicator and the message "sip:<number>@fritz.box registered" every other click

I changed the following server / connection settings to fix the problem:

  • Proxy/Registrar: <FRITZ!Box IP address instead of fritz.box, e.g. 192.168.1.1>
  • Domain/Realm: fritz.box

After that, every time I saved the configuration if would show the success indicator and message and telephony just worked in general.

My local network interface uses an external DNS server for hostname resolution and I have added the fritz.box name manually in my hosts file. This might be why this was causing me problems.

I hope this was of any help to you in case you encountered this as well.

Thanks for reading!

16Nov/140

Mozilla Thunderbird: Changing the EHLO / HELO Value in the “Received”-Header for Outgoing Mail

Hi!

If you have had a look at your outgoing e-mail headers that you've sent from Mozilla Thunderbird, you might have noticed that Thunderbird uses the IP of the network interface that it uses to connect to the internet with by default. If you are using a router on your network, this is a private IP from your LAN (for example 192.168.1.2) instead of one that might be of actual use.

Example:

Received: from external.sender.host.example.org ([123.123.123.123] helo=[192.168.1.2]) by
 mail.example2.org (incoming-mta-service) with esmtpsa (outgoing-mta-service) id
 0a1b2c-3D4e5F6G7h-0a1B2c for <[email protected]>; Sun, 02 Nov 2014 20:55:41 +0100

where "123.123.123.123" is the publicly facing IP and "external.sender.host.example.org" is its hostname.

If you do not wish to expose this information to every and all recipients of the e-mails you are sending with Thunderbird to (maybe out of security concerns in a business environment), you can set the EHLO / HELO value manually for every outgoing e-mail sent by the Thunderbird client with your current user profile and even for every simple SMTP server individually.

Here's how:

Globally

  • Open your Thunderbird options ("Tools" => "Options")
  • "Advanced" => "Config Editor..."
  • Create (or edit) the entry named "mail.smtpserver.default.hello_argument". If you need to create it, use right-click => "New" => "String".
  • Change the value to the desired IP or hostname (FQDN).

Per SMTP server

  • Open your Thunderbird options ("Tools" => "Options")
  • "Advanced" => "Config Editor..."
  • Create (or edit) the entry named "mail.smtpserver.smtp<number>.hello_argument" where <number> is the ID for the SMTP server you would like to apply the setting to. Type "mail.smtpserver.smtp" to see which ones are available and which ID they have. If you need to create the entry, use right-click => "New" => "String".
  • Change the value to the desired IP or hostname (FQDN).

Technically this value is not relevant for sending/receiving the mail, but because it might be used for spam scoring or simply out of courtesy I would recommend entering a valid IP / hostname.

I myself am using 127.0.0.1.

Thanks for reading!

Sources:

   
%d bloggers like this: