Category: Tailscale EN

  • A Digital Noah’s Ark: How UrBackup and TrueNAS Protect Your Data

    A Digital Noah’s Ark: How UrBackup and TrueNAS Protect Your Data

    In today’s digital world, our lives—both personal and professional—are recorded as data. From family photos to crucial company databases, losing this information can be catastrophic. Despite this, many individuals and businesses still treat backups as an afterthought. Here is a complete guide to building a powerful, automated, and secure backup system using free tools: UrBackup, TrueNAS Scale, and Tailscale.

    Why You Need a Plan B: The Importance of Backups

    Imagine one morning your laptop’s hard drive refuses to work. Or the server that runs your business falls victim to a ransomware attack, and all your files are encrypted. These aren’t scenarios from science-fiction films but everyday reality. Hardware failure, human error, malicious software, or even theft—the threats are numerous.

    A backup is your insurance policy. It’s the only way to quickly and painlessly recover valuable data in the event of a disaster, minimising downtime and financial loss. Without it, rebuilding lost information is often impossible or astronomically expensive.

    The Golden Rule: The 3-2-1 Strategy

    In the world of data security, there is a simple but incredibly effective principle known as the 3-2-1 strategy. It states that you should have:

    • THREE copies of your data (the original and two backups).
    • On TWO different storage media (e.g., a disk in your computer and a disk in a NAS server).
    • ONE copy in a different location (off-site), in case of fire, flood, or theft at your main location.

    Having three copies of your data drastically reduces the risk of losing them all simultaneously. If one drive fails, you have a second. If the entire office is destroyed, you have a copy in the cloud or at home.

    A Common Misconception: Why RAID is NOT a Backup

    Many NAS server users mistakenly believe that a RAID configuration absolves them of the responsibility to make backups. This is a dangerous error.

    RAID (Redundant Array of Independent Disks) is a technology that provides redundancy and high availability, not data security. It protects against the physical failure of a hard drive. Depending on the configuration (e.g., RAID 1, RAID 5, RAID 6, or their RAID-Z equivalents in TrueNAS), the array can survive the failure of one or even two drives at the same time, allowing them to be replaced without data loss or system downtime.

    However, RAID will not protect you from:

    • Human error: Accidentally deleting a file is instantly replicated across all drives in the array.
    • Ransomware attack: Encrypted files are immediately synchronised across all drives.
    • Power failure or RAID controller failure: This can lead to the corruption of the entire array.
    • Theft or natural disaster: Losing the entire device means losing all the data.

    Remember: Redundancy protects against hardware failure; a backup protects against data loss.

    image 135

    Your Backup Hub: UrBackup on TrueNAS Scale

    Creating a robust backup system doesn’t have to involve expensive subscriptions. An ideal solution is to combine the TrueNAS Scale operating system with the UrBackup application.

    • TrueNAS Scale: A powerful, free operating system for building NAS servers. It is based on Linux and offers advanced features such as the ZFS file system and support for containerised applications.
    • UrBackup: An open-source, client-server software for creating backups. It is extremely efficient and flexible, allowing for the backup of both individual files and entire disk images.

    The TrueNAS Protective Shield: ZFS Snapshots

    One of the most powerful features of TrueNAS, resulting from its use of the ZFS file system, is snapshots. A snapshot is an instantly created, read-only image of the entire file system at a specific moment. It works like freezing your data in time.

    Why is this so important in the context of ransomware?

    When ransomware attacks and encrypts files on a network share, these changes affect the “live” version of the data. However, previously taken snapshots remain untouched and unchanged because they are inherently read-only. In the event of an attack, you can restore the entire dataset to its pre-infection state in seconds, completely nullifying the effects of the attack.

    You can configure TrueNAS to automatically create snapshots (e.g., every hour) and retain them for a specified period. This creates an additional, incredibly powerful layer of protection that perfectly complements the backups performed by UrBackup.

    Advantages and Disadvantages of the Solution

    Advantages:

    • Full control and privacy: Your data is stored on your own hardware.
    • No licence fees: The software is completely free.
    • Exceptional efficiency: Incremental backups save space and time.
    • Flexibility: Supports Windows, macOS, Linux, physical servers, and VPS.
    • Disk image backups: Ability to perform a “bare-metal restore” of an entire system.

    Disadvantages:

    • Requires your own hardware: You need to have a NAS server.
    • Initial configuration: Requires some technical knowledge.
    • Full responsibility: The user is responsible for the security and operation of the server.

    Step-by-Step: Installation and Configuration

    1. Installing UrBackup on TrueNAS Scale

    1. Log in to the TrueNAS web interface.
    2. Navigate to the Apps section.
    3. Search for the UrBackup application and click Install.
    4. In the most important configuration step, you must specify the path where backups will be stored (e.g., /mnt/YourPool/backups).
    5. After the installation is complete, start the application and go to its web interface.

    2. Basic Server Configuration

    In the UrBackup interface, go to Settings. The most important initial options are:

    • Path to backup storage: This should already be set during installation.
    • Backup intervals: Set how often incremental backups (e.g., every few hours) and full backups (e.g., every few weeks) should be performed.
    • Email settings: Configure email notifications to receive reports on the status of your backups.

    3. Installing the Client on Computers

    The process of adding a computer to the backup system consists of two stages: registering it on the server and installing the software on the client machine.

    a) Adding a new client on the server:

    1. In the UrBackup interface, go to the Status tab.
    2. Click the blue + Add new client button.
    3. Select the option Add new internet/active client. This is recommended as it works both on the local network and over the internet (e.g., via Tailscale).
    4. Enter a unique name for the new client (e.g., “Annas-Laptop” or “Web-Server”) and click Add client.

    b) Installing the software on the client machine:

    1. After adding the client on the server, while still on the Status tab, you will see buttons to Download client for Windows and Download client for Linux.
    2. Click the appropriate button and select the name of the client you just added from the drop-down list.
    3. Download the prepared installation file (.exe or .sh). It is already fully configured to connect to your server.
    4. Run the installer on the client computer and follow the instructions.

    After a few minutes, the new client should connect to the server and appear on the list with an “Online” status, ready for its first backup.

    Security Above All: Tailscale Enters the Scene

    How can you securely back up computers located outside your local network? The ideal solution is Tailscale. It creates a secure, private network (a mesh VPN) between all your devices, regardless of their location.

    Why use Tailscale with UrBackup?

    • Simplicity: Installation and configuration take minutes.
    • “Zero Trust” Security: Every connection is end-to-end encrypted.
    • Stable IP Addresses: Each device receives a static IP address from the 100.x.x.x range, which does not change even when the device moves to a different physical location.

    What to do if the IP address changes?

    If for some reason you need to change the IP address of the UrBackup server (e.g., after switching from another VPN to Tailscale), the procedure is simple:

    1. Update the address on the UrBackup server: In Settings -> Internet/Active Clients, enter the new, correct server address (e.g., urbackup://100.x.x.x).
    2. Download the updated installer: On the Status tab, click Download client, select the offline client from the list, and download a new installation script for it.
    3. Run the installer on the client: Running the new installer will automatically update the configuration on the client machine.

    Managing and Monitoring Backups

    The UrBackup interface provides all the necessary tools to supervise the system.

    • Status: The main dashboard showing a list of all clients, their online/offline status, and the status of their last backup.
    • Activities: A live view of currently running operations, such as file indexing or data transfer.
    • Backups: A list of all completed backups for each client, with the ability to browse and restore files.
    • Logs: A detailed record of all events, errors, and warnings—an invaluable tool for diagnosing problems.
    • Statistics: Charts and tables showing disk space usage by individual clients over time.

    Backing Up Databases: Do It Right!

    Never back up a database by simply copying its files from the disk while the service is running! This risks creating an inconsistent copy that will be useless. The correct method is to perform a “dump” using tools like mysqldump or mariadb-dump.

    Method 1: All Databases to a Single File

    A simple approach, ideal for small environments.

    Command: mysqldump –all-databases -u [user] -p[password] > /path/to/backup/all_databases.sql

    Method 2: Each Database to a Separate File (Recommended)

    A more flexible solution. The script below will automatically save each database to a separate, compressed file. It should be run periodically (e.g., via cron) just before the scheduled backup by UrBackup.

    #!/bin/bash
    
    # Configuration
    BACKUP_DIR="/var/backups/mysql"
    DB_USER="root"
    DB_PASS="YourSuperSecretPassword"
    
    # Check if user and password are provided
    if [ -z "$DB_USER" ] || [ -z "$DB_PASS" ]; then
        echo "Error: DB_USER or DB_PASS variables are not set in the script."
        exit 1
    fi
    
    # Create backup directory if it doesn't exist
    mkdir -p "$BACKUP_DIR"
    
    # Get a list of all databases, excluding system databases
    DATABASES=$(mysql -u "$DB_USER" -p"$DB_PASS" -e "SHOW DATABASES;" | tr -d " " | grep -vE "(Database|information_schema|performance_schema|mysql|sys)")
    
    # Loop through each database
    for db in $DATABASES; do
        echo "Dumping database: $db"
        # Perform the dump and compress on the fly
        mysqldump -u "$DB_USER" -p"$DB_PASS" --databases "$db" | gzip > "$BACKUP_DIR/$db-$(date +%Y-%m-%d).sql.gz"
        if [ $? -eq 0 ]; then
            echo "Dump of database $db completed successfully."
        else
            echo "Error during dump of database $db."
        fi
    done
    
    # Optional: Remove old backups (older than 7 days)
    find "$BACKUP_DIR" -type f -name "*.sql.gz" -mtime +7 -exec rm {} \;
    
    echo "Backup process for all databases has finished."
    

    Your Digital Fortress

    Having a solid, automated backup strategy is not a luxury but an absolute necessity. Combining the power of TrueNAS Scale with its ZFS snapshots, the flexibility of UrBackup, and the security of Tailscale allows you to build a multi-layered, enterprise-class defence system at zero software cost.

    It is an investment of time that provides priceless peace of mind. Remember, however, that no system is entirely maintenance-free. Regularly monitoring logs, checking email reports, and, most importantly, periodically performing test restores of your files are the final, crucial elements that turn a good backup system into an impregnable fortress protecting your most valuable asset—your data.

  • An End to Intrusive Adverts: How to Reclaim Control of the Internet at Home and Away. AdGuard Home.

    An End to Intrusive Adverts: How to Reclaim Control of the Internet at Home and Away. AdGuard Home.

    The modern internet is a battlefield for our attention, and adverts have become the primary ammunition. This is felt particularly acutely on smartphones, where intrusive banners and pop-up windows can effectively discourage you from browsing content. However, there is an effective and comprehensive solution that allows you to create your own protective shield, not only on your home network but on any device, wherever you are.

    The Problem: Digital Clutter and Loss of Privacy

    Anyone who has tried to read an article on a smartphone is familiar with this scenario: the content is regularly interrupted by adverts that take up a significant portion of the screen, slow down the page’s loading time, and consume precious mobile data. While this problem is irritating on desktop computers, on smaller screens it becomes a serious barrier to accessing information.

    Traditional browser plug-ins solve the problem only partially and on a single device. They don’t protect us in mobile apps, on Smart TVs, or on games consoles. What’s worse, ubiquitous tracking scripts collect data about our activity, creating detailed marketing profiles.

    The Solution: Centralised Management with AdGuard Home

    The answer is AdGuard Home—software that acts as a DNS server, filtering traffic at a network-wide level. By installing it on a home server, such as the popular TrueNAS, we gain a central point of control over all devices connected to our network.

    image 125

    Installation and configuration of AdGuard Home on TrueNAS are straightforward thanks to its Apps system. A key step during installation is to tick the “Host Network” option. This allows AdGuard Home to see the real IP addresses of the devices on your network, enabling precise monitoring and management of clients in the admin panel. Without this option, all queries would appear to originate from the server’s single IP address.

    After installation, the crucial step is to direct DNS queries from all devices to the address of our AdGuard server. This can be achieved in several ways, but thanks to Tailscale, the process becomes incredibly simple.

    Traditional Methods vs. The Tailscale Approach

    In a conventional approach, to direct traffic to AdGuard Home, we would need to change the DNS addresses in our router’s settings. When this isn’t possible (which is often the case with equipment from an internet service provider), the alternative is to configure AdGuard Home as a DHCP server, which will automatically assign the correct DNS address to devices (this requires disabling the DHCP server on the router). The last resort is to change the DNS manually on every device in the house. It must be stressed, however, that all these methods work only within the local network and are completely ineffective for mobile devices using cellular data away from home.

    However, if we plan to use Tailscale for protection outside the home, we can also use it to configure the local network. This is an incredibly elegant solution: if we install the Tailscale client on all our devices (computers, phones) and set our AdGuard server’s DNS address in its admin panel, enabling the “Override local DNS” option, we don’t need to make any changes to the router or manually on individual devices. Tailscale will automatically force every device in our virtual network to use AdGuard, regardless of which physical network it is connected to.

    image 126

    AdGuard Home Features: Much More Than Ad Blocking

    • Protection against Malware: Automatically blocks access to sites known for phishing, malware, and scams.
    • Parental Controls: Allows you to block sites with adult content, an invaluable feature in homes with children.
    • Filter Customisation: We can use ready-made, regularly updated filter lists or add our own rules.
    • Detailed Statistics: The panel shows which queries are being blocked, which devices are most active, and which domains are generating the most traffic.

    For advanced users, the ability to manage clients is particularly useful. Each device on the network can be given a friendly name (e.g., “Anna-Laptop,” “Tom-Phone”) and assigned individual filtering rules. In my case, for VPS servers that do not require ad blocking, I have set default DNS servers (e.g., 1.1.1.1 and 8.8.8.8), so their traffic is ignored by the AdGuard filters.

    The Challenge: Blocking Adverts Beyond the Home Network

    While protection on the local network is already a powerful tool, true freedom from adverts comes when we can use it away from home. By default, when a smartphone connects to a mobile network, it loses contact with the home AdGuard server. Attempting to expose a DNS server to the public internet by forwarding ports on your router is not only dangerous but also ineffective. Most mobile operating systems, like Android and iOS, do not allow changing the DNS server for mobile connections, making such a solution impossible. This is where Tailscale comes to the rescue.

    Tailscale: Your Private Network, Anywhere

    Tailscale is a service based on the WireGuard protocol that creates a secure, virtual private network (a “Tailnet”) between your devices. Regardless of where they are, computers, servers, and phones can communicate with each other as if they were on the same local network.

    Installing Tailscale on TrueNAS and on mobile devices is swift and straightforward. After logging in with the same account, all devices see each other in the Tailscale admin panel. To combine the power of both tools, you need to follow these key steps:

    1. In the Tailscale admin panel, under the DNS tab, enable the Override local DNS option.
    2. As the global DNS server, enter the IP address of our TrueNAS server within the Tailnet (e.g., 100.x.x.x).

    With this configuration, all DNS traffic from our phone, even when it’s using a 5G network on the other side of the country, is sent through a secure tunnel to the Tailscale server on TrueNAS and then processed by AdGuard Home. The result? Adverts, trackers, and malicious sites are blocked on your phone, anytime and anywhere.

    Advanced Tailscale Features: Subnet Routes and Exit Node

    Tailscale offers two powerful features that further extend the capabilities of our network:

    • Subnet routes: This allows you to share your entire home LAN (e.g., 192.168.1.0/24) with devices on your Tailnet. After configuring your TrueNAS server as a “subnet router,” your phone, while away from home, can access not only the server itself but also your printer, IP camera, or other devices on the local network, just as if you were at home.
    • Exit node: This feature turns your home server into a fully-fledged VPN server. Once activated, all internet traffic from your Tailnet (not just DNS queries) is tunnelled through your home internet connection. This is the perfect solution when using untrusted public Wi-Fi networks (e.g., in a hotel or at an airport), as all your traffic is encrypted and protected. If your home server is in the UK, you also gain a UK IP address while abroad.

    Checking the Effectiveness of Ad Blocking

    To find out how effective your ad-blocking filters are, you can visit https://adblock.turtlecute.org/. There, you will see what types of adverts are being blocked and which are still being displayed. This will help you to fine-tune your filter lists in AdGuard Home.

    image 127

    Summary: Advantages and Disadvantages

    Creating such a system is an investment of time, but the benefits are invaluable.

    Advantages:

    • Complete and Unified Protection: Blocks adverts and threats on all devices, on any network, with minimal configuration.
    • Centralised Management: A single place to configure rules for the entire household.
    • Increased Privacy and Security: Reduces tracking and encrypts traffic on public networks.
    • Performance: Faster page loading and lower mobile data consumption.

    Disadvantages:

    • Requires a Server: Needs a 24/7 device like a TrueNAS server to be running.
    • Initial Setup: Requires basic technical knowledge.
    • Dependency on Home Connection: The speed of DNS responses and bandwidth (in Exit Node mode) outside the home depends on your internet’s upload speed.

    The combination of AdGuard Home and Tailscale is a powerful tool for anyone who values a clean, fast, and secure internet. It is a declaration of digital independence that places control back into the hands of the user, away from advertising corporations.