Offsite backup with Unraid, Tailscale, Backrest/Restic and Tailvault

Restic and its companion UI Backrest already allow you to back up to many different locations. However, getting it setup to back up from one Unraid NAS to another might not be straight forward. Here I will go into details on the steps I have used to to make it work.

The goals of this setup are:

  1. Sender will use Backrest while receiver will use Tailvault app in Unraid.
  2. Both apps will have Tailscale integration enabled, and connectivity will be via Tailscale.

Tailvault is a very simple Alpine container that enables SFTP. However, Restic doesn’t support SFTP with password, hence the need for additional setup for key pairs between the 2 containers.

  1. Generate a keypair with PuTTYgen, choose EdDSA and Ed25519
    • After the pair is generated, click Conversions >Export OpenSSH Key and named it id_ed25519
    • The public key can be copied from the box “Public key for pasting into OpenSSH authorized_keys file:”
  2. Install TailVault app in the Community Store with the following modifications:
    • Repository: nguyenquyhy/tailvault:latest
    • Remove SFTP_PASS
    • Add SFTP_PUB_KEY. Use the public key in step 1 as value.
  3. Open TailVault container log and login to Tailscale using the link in log
  4. Open appdata/TailVault and download ssh_host_ed25519_key.pub
  5. Install Backrest app in the Community Store with Tailscale enabled
  6. Open Backrest container log and login to Tailscale using the link in log
  7. Create known_hosts file on your computer with the following content:
    • <tailvault domain from Tailscale> <content from ssh_host_ed25519_key.pub in step 3>
    • e.g. tailvault.abc.ts.net ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA root@aaaaaaaaa
  8. Upload id_ed25519 from step 1 and known_hosts from step 5 to appdata/backrest
  9. Select id_ed25519, click Permissions, change Group and Other to No Access
  10. Edit backrest app in Unraid’s Docker and add the following:
    • Path:
      • Name: Private Key
      • Container Path: /root/.ssh/id_ed25519
      • Host Path: /mnt/user/appdata/backrest/id_ed25519
    • Path:
      • Name: Known Host
      • Container Path: /root/.ssh/known_hosts
      • Host Path: /mnt/user/appdata/backrest/known_hosts
  11. Open backrest URL
  12. Add repo. For Repository URL, use sftp:<username set in step 2>@<tailvault domain from Tailscale>:/backups

New country and a new PC

It has been a while since I last published a new post here. I still have quite a number of drafts lining up, but has never managed to come around to finish them. Probably I should restart writing with some update on my life and some interesting things I learned recently.

A couple months ago I moved to a new country halfway around the world with a new job (or actually same old job in a different company), and I took this chance to learn to build a new PC. I have had a bit of experience with PC hardware before, but mainly from replacing part from a complete build, rather than building from an empty case, so this would be my first time having to work with a new case and mainboard.

Read More

Azure Notification Hub SDK on .NET Standard and WNS Raw notification

Update (3 Oct 2018): Thanks to the beloved-by-community Jon Galloway, I can finally connect with the engineers working on the library. Hopefully, the team can push out a fix soon.

Update (13 Oct 2018): Microsoft team has quickly release version 2.0.1 with proper fix for the issue. Bravo for the team!

I have been using Azure Notification Hub for a very long time to send push notifications to my UWP apps on Windows 10. Since the introduction of .NET Core 1.0, I have gradually been moving my projects from .NET Framework to .NET Core. However, Microsoft.Azure.NotificationHubs was always the blockers due to the lack of support for .NET Standard.

Tl;dr version:

  • 2.0.0-preview1 and preview2 have issue sending WNS Raw message.
  • After 8 months, 2.0.0 was released with the same issue.
  • There was no place to report the issue.
  • There was no source code.
  • The fix is only 1 LOC, but I spent much more time to make the decompiled code compile back.
  • And now I have still no way to report the issue nor contribute the fix.
Read More