Skip Navigation

confusedpuppy

@confusedpuppy.lemmy.dbzer0.com.ap.tdpl.io

10 Posts47 Comments0 Memberships

Joined July 2026

  • Self Hosting Minimalism

    I have two Raspberry Pi's I bought used a few years ago. An RPi4 that is dedicated to HomeAssistant which controls 6 coloured lights and two dimmer switches. The other is an RPi5 which hosts a Kiwix instance and a simple file server which has a few survival/sustainability ebooks, Linux/scripting resources and copies of my git repos. It also has an encrypted USB SSD that holds a copy of my backups. I intend to add a blog to this but first I am going to build new install scripts for both RPi servers. All of my devices run Alpine Linux with Podman containers and a minimal set of packages to make it all work.

    My main focus over the past few years has been working with low powered or used devices. I can't say I predicted today's hardware pricing insanity but I saw early trends that discouraged me from investing heavily in newer or more powerful technology. Scaling down my expectations has helped reduce a lot ot headaches, especially with all these new vulnerabilities lately.

    I've always felt a bit out of place within any self hosting community with my focus on simplicity/minimalism and alternative solutions which has unintentionally challenged current hosting practices and norms. I have had a number of strange interactions within the self hosting community for my approach which has discouraged me from engaging more.

    I would like to hear from others who self host on the more simple side of things. What hardware do you use? What do you host? Do you track your energy usage? How have you kept things simple or minimal? What are some experiences you would like to share?

    I would enjoy hearing from the simpler side of things because wow, things are overwhelming lately.

  • Looking to move from Caddy

    Recently it's come to my attention that Caddy has an AI sponsor so I have been looking at moving away from Caddy. I'm currently looking for another reverse proxy to use in place of Caddy. For TLS I am looking into using CertBot and it appears there's a module (https://github.com/desec-io/certbot-dns-desec) I can use that works for https://desec.io/ to handle my certs. I have two questions, the first is about CertBot. Since Caddy is handling my certs automatically, how often would I want to renew my certs? Desec.io has this command to obtain a cert:

     
    certbot certonly \
         --authenticator dns-desec \
         --dns-desec-credentials /etc/letsencrypt/secrets/$DOMAIN.ini \
         -d "$DOMAIN" \
         -d "*.$DOMAIN"

    Would I be required to run the same command periodically to renew my cert? My second question is a bit more open ended. I am looking to hear any suggestions or experiences about different reverse proxies that are preferably free of AI. There is a list here with some suggested alternatives: https://codeberg.org/ethical-foss/open-slopware#web-servers

  • nftables: Can't ping my own server

    Podman is no longer supporting iptables so I am trying to learn how to set up nftables in its place. It's been a struggle to get it to work properly. I can not ping my own server after starting the nftables rules. I am using Alpine Linux v2.24.1 and nftables v1.1.6 (Commodore Bullmoose #7). nftables has a config file with basic rules which include receiving pings: /etc/nftables.nft

     
    #!/usr/sbin/nft -f
    # vim: set ts=4 sw=4:
    # You can find examples in /usr/share/nftables/.
    
    # Clear all prior state
    flush ruleset
    
    # Basic IPv4/IPv6 stateful firewall for server/workstation.
    table inet filter {
    	chain input {
    		type filter hook input priority 0; policy drop;
    
    		iifname lo accept \
    		comment "Accept any localhost traffic"
    
    		ct state { established, related } accept \
    		comment "Accept traffic originated from us"
    
    		ct state invalid drop \
    		comment "Drop invalid connections"
    
    		tcp dport 113 reject with icmpx type port-unreachable \
    		comment "Reject AUTH to make it fail fast"
    
    		# ICMPv4
    
    		ip protocol icmp icmp type {
    			echo-reply,  # type 0
    			destination-unreachable,  # type 3
    			echo-request,  # type 8
    			time-exceeded,  # type 11
    			parameter-problem,  # type 12
    		} accept \
    		comment "Accept ICMP"
    
    		# ICMPv6
    
    		icmpv6 type {
    			destination-unreachable,  # type 1
    			packet-too-big,  # type 2
    			time-exceeded,  # type 3
    			parameter-problem,  # type 4
    			echo-request,  # type 128
    			echo-reply,  # type 129
    		} accept \
    		comment "Accept basic IPv6 functionality"
    
    		icmpv6 type {
    			nd-router-solicit,  # type 133
    			nd-router-advert,  # type 134
    			nd-neighbor-solicit,  # type 135
    			nd-neighbor-advert,  # type 136
    		} ip6 hoplimit 255 accept \
    		comment "Allow IPv6 SLAAC"
    
    		icmpv6 type {
    			mld-listener-query,  # type 130
    			mld-listener-report,  # type 131
    			mld-listener-reduction,  # type 132
    			mld2-listener-report,  # type 143
    		} ip6 saddr fe80::/10 accept \
    		comment "Allow IPv6 multicast listener discovery on link-local"
    
    		ip6 saddr fe80::/10 udp sport 547 udp dport 546 accept \
    		comment "Accept DHCPv6 replies from IPv6 link-local addresses"
    	}
    
    	chain forward {
    		type filter hook forward priority 0; policy drop;
    	}
    
    	chain output {
    		type filter hook output priority 0; policy accept;
    	}
    }
    
    # The state of stateful objects saved on the nftables service stop.
    include "/var/lib/nftables/*.nft"
    
    # Rules
    include "/etc/nftables.d/*.nft"

    I also have a small config file: /etc/nftables.d/firewall.nft

     
    #!/usr/sbin/nft -f
    
    define WIREGUARD_PORT = 51820
    define WIREGUARD_ADDRESS = 10.0.0.0/24
    define SSH_PORT = 5025
    define SSH_ADDRESSES = { $WIREGUARD_ADDRESS . $SSH_PORT, 192.168.40.204 . $SSH_PORT }
    define PUBLIC_PORTS = { 5050 }
    
    table inet filter {
    	chain input {
    		udp dport $WIREGUARD_PORT accept \
    		comment "Accept WireGuard connections"
    
    		ip saddr . tcp dport $SSH_ADDRESSES accept \
    		comment "Accept SSH connections from known devices or WireGuard"
    
    		tcp dport $PUBLIC_PORTS accept \
    		comment "Accept public connections"
    	}
    }

    After loading the new rules, I get the following output while listing the ruleset:

     
    21:23 server-pi:~ $ doas nft list ruleset
    table inet filter {
    	chain input {
    		type filter hook input priority filter; policy drop;
    		iifname "lo" accept comment "Accept any localhost traffic"
    		ct state { established, related } accept comment "Accept traffic originated from us"
    		ct state invalid drop comment "Drop invalid connections"
    		tcp dport 113 reject comment "Reject AUTH to make it fail fast"
    		ip protocol icmp icmp type { echo-reply, destination-unreachable, echo-request, time-exceeded, parameter-problem } accept comment "Accept ICMP"
    		icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, echo-request, echo-reply } accept comment "Accept basic IPv6 functionality"
    		icmpv6 type { nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert } ip6 hoplimit 255 accept comment "Allow IPv6 SLAAC"
    		icmpv6 type { mld-listener-query, mld-listener-report, mld-listener-done, mld2-listener-report } ip6 saddr fe80::/10 accept comment "Allow IPv6 multicast listener discovery on link-local"
    		ip6 saddr fe80::/10 udp sport 547 udp dport 546 accept comment "Accept DHCPv6 replies from IPv6 link-local addresses"
    		udp dport 51820 accept comment "Accept WireGuard connections"
    		ip saddr . tcp dport { 10.0.0.0/24 . 5025, 192.168.40.204 . 5025 } accept comment "Accept SSH connections from known devices or WireGuard"
    		tcp dport 5050 accept comment "Accept public connections"
    	}
    
    	chain forward {
    		type filter hook forward priority filter; policy drop;
    	}
    
    	chain output {
    		type filter hook output priority filter; policy accept;
    	}
    }
    21:23 server-pi:~ $ doas netstat -tunlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      3515/rootlessport   
    tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      3584/rootlessport   
    tcp        0      0 0.0.0.0:5025            0.0.0.0:*               LISTEN      3743/sshd: /usr/sbi 
    tcp6       0      0 :::5025                 :::*                    LISTEN      3743/sshd: /usr/sbi 
    tcp6       0      0 :::5050                 :::*                    LISTEN      3515/rootlessport   
    udp        0      0 0.0.0.0:51820           0.0.0.0:*                           -                   
    udp6       0      0 :::51820                :::*                                -                   
    21:23 server-pi:~ $ 

    I can connect perfectly fine with SSH, WireGuard and my reverse proxy on port 5050 but if I ping the server I don't get any response at all. Pings worked as normal when I was using iptables so I am not sure what I am doing wrong with nftables. I've tried to keep the rules as simple as possible to figure out what is happening but I have not been able to make any progress. Any help would be appreciated.

  • rTransfer: An rsync command line helper tool

    Last year I created an rsync tool for myself. In short, It's purpose was to build rsync commands within a config file and use those files to build and run rsync commands. I preferred this over the every growing list of rsync commands I was experiencing. Making aliases for everything and keeping commands unified and neat was becoming overwhelming for myself. Recently I've been sick so I used my free time to completely rewrite the script using all the knowledge I've learned over the last year writing some other scripts. I took out some features that were too specific, made the code much cleaner and easier to maintain and made the visual output easier to read and understand. The script has a number of additional features including: • Running multiple config files from a single command • The base command will do a dry run to allow you to preview changes before committing to a transfer • An option to quickly do a dry run to simply view any changes • An option to quickly reverse the source/destination transfer direction • An option to ignore the dry run and instantly perform a sync • The ability to create a template config file that's (hopefully) easy to read and fill out • Feedback for a number of common issues so that the rsync command will not run, hopefully avoiding any data loss issues • An option to print out the full rsync command built from a config file (sometimes I want to move a specific file without creating a new, one time use config file) • Built with ssh and ssh key files in mind • Single file and POSIX portable with rsync as it's only dependency • Long command option names for easier scripting One notable change I made from my first script and the rewrite was using the sed command to gather information from the config files instead of directly sourcing into the main script. It's slightly less efficient but more secure than accidentally running commands while using the source (.) command. I'm still trying to figure out how to make it slightly more efficient but for now it works how I like it to work. I've had such terrible luck with fully featured syncing programs (Syncthing for example) and have always had much better consistency with rsync (at the loss of bi-directional, continuous syncing). I also hated building rsync commands so this tool has been a great compromise for myself.

    codeberg.org
  • My POSIX portable working example/code library script

    The Script While researching and learning different tasks to do for my personal scripts, I tried keeping my code examples in different files in a directory. It was very unorganized and a bit overwhelming to deal. Instead I started writing a script that functions as a library for all the things I have learned. The script keeps everything in one spot and it's much easier to work on it. It also acts as a functioning style guide for myself so I can standardize my own future scripts. It's also easy to add code or work on existing code. I usually have it open whenever I am writing something new to use as a quick reference guide. Some of the features I have worked on include: • Making it easier to use POSIX getopts. I can easily add long options. I also made it simple for me to process arguments or deal with conflicting options. • Working with simple "arrays" (positional parameters). There's a nice little function that can save the array to a variable which can then be set again to be used in different parts of the script. • a Yes/No confirmation function which can accept a y or n character instantly without pressing enter to proceed. • A few of examples extracting data from variables using variable expansions • An enter password function that works similar to the read -rscommand • A couple examples of using the trap command to help reset changes made during a script I tried my best to make it easy and obvious to understand. I know future me would get annoyed trying to relearn something I worked on before when I am focused on the script I want to write currently. I'm learning more about the very basic commands of Linux which is why I prefer writing POSIX portable scripts over Bash scripts. Deconstructing read -rs is a good example. I got to play around with the stty command and learn a couple things about terminal settings. It's a nice, simple and ongoing project. Maybe there is something useful in there for anyone else writing POSIX portable scripts. I would like to learn a little about awk and sed in the future but I haven't found a project yet where that can be used.

  • A POSIX script for mounting an encrypted device

    Last year while I was learning to self-host some services on a Raspberry Pi I came across Alpine Linux. The very minimal environment of Alpine Linux was something that really interested me. Somewhere along the way I started writing scripts. Since Bash wasn't my default shell and I was missing a lot of other programs that would normally be pre-installed under other distributions, I unintentionally started writing POSIX portable scripts. I continued writing with POSIX in mind because I not only found it interesting but it was also giving me a better understanding of how Linux works under the hood. I was always curious about how windows worked when I was using it but it always seemed so much more complex and intimidating. This specific script I wrote was meant to make mounting and unmounting a LUKS encrypted device from the command line easier and a bit safer. Eventually I extended the functionality to automatically decrypt, mount, execute a command, unmount and reencrypt the device in one single command. My reasoning for this is because I use external encrypted USB drives to backup my computer, phone and two RPi devices. I wanted to still enter my passphrase but I didn't want to forget to reencrypt my device after updating the backup. Some of the things I learned while writing this script in particular was working with getopts and changing terminal settings with stty. There are a bunch of other small things I learned to work around the limited tools I had available but it would be too much to try and list them all. With getopts I managed to find a few ways to make it manageable and easy to work with long options. That makes it much easier to use this script within other scripts since I don't have to remember what each single character short option name does. The limitation with getopts and long option names is that the long option requires an '=' character but it works consistently which is what matters to me. With stty I learned how to disable and reenable job control (default CTRL+Z in a terminal) as a way to prevent the script from being interrupted and leaving the device unencrypted because the script couldn't continue with the unmounting trap command. I spent a couple months of my free time working on this script but it's at the point where I am comfortable and very happy with how it turned out. It's a single file, POSIX portable and only requires cryptsetup as it's only dependency. I'll apologize for the commenting in advance, I find the shouty comments help me understand what's happening with the script better than trying to remember what each command or variable does. It's also might seem silly in some places but it's consistent which is also important to me. The Script: emountman

  • Created a tool for Rsync transfers

    Ever since I started down the self-hosting rabbit hole one issue I've been constantly annoyed with is transferring files between machines. Especially files which I am currently working on and that I want to periodically transfer to a specific remote location.

    Rsync has been my go to tool for file transfers and backups but I absolutely hate making commands for it. I was getting lost in a wall of text with all my rsync aliases.

    The script I created helps me organize those commands by placing all the information for an rsync command into an easier to read dot-file. The script will read the dot-file, update the rsync command and run it. It's also set up to preview file transfers with rsync's dry run option. I've also added a few other features to make the script more flexible including being able to quickly backup a directory that I'm currently working in.

    For self-hosting, I find working with files a bit easier to organize than a text full of aliases although I can see it easy to get overwhelmed with dot-files if some people aren't organized.

    I've also made it as POSIX shell friendly as possible. I know a couple things I did aren't fully POSIX compliant currently but I that's something to work towards. This is also the first programming thing I ever completed so I'm quite happy with how it turned out.

    If at least one other person finds this script useful, that would be pretty neat :)

    codeberg.org
  • Looking for help: Running the same commands for multiple, similar variables

    For fun, convenience and a chance to learn shell scripting for myself, I've been working on a collection of scripts to semi-automate the backup of my computer, two network connected Raspberry Pi's and my Android phone with Termux. The main script basically runs a bunch of remote backup scripts, then copies those remote backups to a dedicated partition on my computer and finally creates a copy of that partition to an external drive connected to my computer. I use rsync and it's dry run feature so I am able to examine any file changes which has been super useful to me for catching mistakes and issues as I've been learning how to self-host over the past half year. I have a simplified version of those backup scripts that makes a copy of my /home directory:

     
    #!/bin/sh
    
    
    
    # VARIABLES
    ## ENABLE FILE TRANSFER: Change variable `DRY_RUN` to `#DRY_RUN` to enable file tranfers
    DRY_RUN="--dry-run" # Disables all file transfers
    
    ## PATHS (USER DEFINED)
    SOURCE_DIRECTORY_PATH="/home"
    SOURCE_DIRECTORY_PATH_EXCLUSIONS="--exclude=lost+found --exclude=.cache/*"
    BACKUP_NAME="home"
    BACKUP_BASE_PATH="/backup"
    
    ## PATHS (SCRIPT DEFINED/DO NOT TOUCH)
    SOURCE_DIR="${SOURCE_DIRECTORY_PATH}/"
    DESTINATION_DIR="${BACKUP_BASE_PATH}/${BACKUP_NAME}/"
    
    ## EXCLUSIONS (SCRIPT DEFINED/DO NOT TOUCH)
    EXCLUDE_DIR="${SOURCE_DIRECTORY_PATH_EXCLUSIONS}"
    
    ## OPTIONS (SCRIPT DEFINED/DO NOT TOUCH)
    OPTIONS="--archive --acls --one-file-system --xattrs --hard-links --sparse --verbose --human-readable --partial --progress --compress"
    OPTIONS_EXTRA="--delete --numeric-ids"
    
    
    
    # FUNCTIONS
    ## SPACER
    SPACER() {
        printf "\n\n\n\n\n"
    }
    
    ## RSYNC ERROR WARNINGS
    ERROR_WARNINGS() {
        if [ "$RSYNC_STATUS" -eq 0 ]; then
    
            # SUCCESSFUL
            printf "\nSync successful"
            printf "\nExit status(0): %s\n" "$RSYNC_STATUS"
    
        else
            # ERRORS OCCURED
            printf "\nSome error occurred"
            printf "\nExit status(0): %s\n" "$RSYNC_STATUS"
        fi
    }
    
    ## CONFIRMATION (YES/NO)
    CONFIRM_YESNO() {
        while true; do
            prompt="${1}"
            printf "%s (Yes/No): " "${prompt}" >&2 # FUNCTION CALL REQUIRES TEXT PROMPT ARGUMENT
            read -r reply
            case $reply in
                [Yy]* ) return 0;; # YES
                [Nn]* ) return 1;; # NO
                * ) printf "Options: y / n\n";;
            esac
        done
    }
    
    
    
    ##### START
    
    # CHECK FOR ROOT
    if ! [ "$(id -u)" = 0 ]; then
    
        # EXIT WITH NO ACTIONS TAKEN
        printf "\nRoot access required\n\n"
        return
    
    else
        printf "\nStarting backup process..."
    
        # ${SOURCE_DIR} TO ${DESTINATION_DIR} DRY RUN
        SPACER
        printf "\nStarting %s dry run\n" "${SOURCE_DIR}"
        rsync --dry-run ${OPTIONS} ${OPTIONS_EXTRA} ${EXCLUDE_DIR} "${SOURCE_DIR}" "${DESTINATION_DIR}"
        RSYNC_STATUS=$?
        ERROR_WARNINGS
    
        # CONFIRM ${SOURCE_DIR} TO ${DESTINATION_DIR} BACKUP
        SPACER
        if CONFIRM_YESNO "Proceed with ${SOURCE_DIR} backup?"; then
    
            # CONTINUE ${SOURCE_DIR} TO ${DESTINATION_DIR} BACKUP & EXIT
            printf "\nContinuing %s backup\n" "${SOURCE_DIR}"
            rsync ${DRY_RUN} ${OPTIONS} ${OPTIONS_EXTRA} ${EXCLUDE_DIR} "${SOURCE_DIR}" "${DESTINATION_DIR}"
            RSYNC_STATUS=$?
            ERROR_WARNINGS
    
            printf "\n%s backup completed\n\n" "${SOURCE_DIR}"
            return
    
        else
            # SKIP ${SOURCE_DIR} TO ${DESTINATION_DIR} BACKUP & EXIT
            printf "\n%s backup skipped\n\n" "${SOURCE_DIR}"
            return
        fi
    fi
    
    ##### FINISH

    I would like to adapt this script so that I can add multiple copies of the following variables:

     
    ## PATHS (USER DEFINED)
    SOURCE_DIRECTORY_PATH="/home"
    SOURCE_DIRECTORY_PATH_EXCLUSIONS="--exclude=lost+found --exclude=.cache/*"
    BACKUP_NAME="home"
    BACKUP_BASE_PATH="/backup"

    without having to make multiple copies of the following commands within the running script:

     
        # ${SOURCE_DIR} TO ${DESTINATION_DIR} DRY RUN
        SPACER
        printf "\nStarting %s dry run\n" "${SOURCE_DIR}"
        rsync --dry-run ${OPTIONS} ${OPTIONS_EXTRA} ${EXCLUDE_DIR} "${SOURCE_DIR}" "${DESTINATION_DIR}"
        RSYNC_STATUS=$?
        ERROR_WARNINGS

    I'm mainly just looking for a way to avoid touching the script commands itself so I don't have to change the variable names for each additional directory I want to add. I'm not sure what that would be called or where to look. Any help would be greatly appreciated.