• 1 Post
  • 15 Comments
Joined 1 year ago
cake
Cake day: June 20th, 2025

help-circle
  • I have an admin account on the server and an SSO admin login for the services. Different credentials obviously - ones an SSH key and ones a password/passkey for SSO - but it seems to fit well. My regular account is bozo level and I don’t need to worry much, I just logout or go to a private window to do admin for an specific program, which is rare but easy enough when it’s needed.

    So far for the SSO services with an admin account design, I just set it up so the admin account for the service is named the SSO admin account so it maps directly when I connect the SSO to it.

    And I SSH into the server for admin there as needed.

    And no mixing with my regular user account!


  • Install incus on your OS of choice to manage LXCs and VMs, it’s ideal!

    No need to chain yourself to an OS that is rolling on the free branch, get stability and control!

    As for LXCs vs Podman containers, seems it is preference of control. LXCs are little OSes you need to keep up to date, containers need to be rebuilt to keep up to date. (I think only Linuxserver images actually rebuild just for base OS updates, hopefully the reverse proxy and authentication images too)

    Podman brings some nice networking, read-only features, and user abstraction with it, I think that helps it push ahead.

    That said, LXCs are little OSes and that flexibility can be very useful. For instance, incus is able to make an LXC with a unique Mac from an Ethernet adapter - I haven’t cooked how to do that with Podman yet. So I run my DNS from there so it doesn’t mess with my server’s DNS port.


  • For distro I’d recommend God’s Chosen Stock Debian. You want prioritize smooth upgrade paths from one major version to another since the server should last a long ass time, and Debian is that. Debian has the eyes on it to make it chill and if there are things to do they’re caught and noted (and more often something is set up to just do it for you).

    So no, distro doesn’t matter as long as you can get your software going. But you’re not going to beat the insane stability of Debian. Any OS based on it is just an echo, which may even involve custom kernels which add more work for the specific distro maintainers and may slow critical security updates.

    I run no GUI but you can def have one. I just SSH in. I do everything in containers (Docker 1st and I’m moving to Podman - but Podman is too heavy a lift to start, Docker compose files are always right there, use em) and LXC containers run by Incus (it has a web gui as well!).

    I’ve been looking at “games on whales” https://games-on-whales.github.io/ to stream games from a beefy server to weaker computers and tablets. Might be a good route for your games without having to directly game on the server.

    I have a 4 core 7th gen Intel CPU and it seems fine with doing x265 transcoding on multiple streams, but I’ve never tried finding out how many 4K ones it can do at once. I have 32 GB of RAM (I bought cheapo laptop RAM before the true AI shitshow, praise be, stuck them in with a DIMM board cooked up by China). I had 16 before that, and it was fine. But I just kept adding services.

    An LLM will eat your RAM, you’d want 32 GB to be able to run a 16 GB one. But a GPU will be much, much faster. LLMs are just matrix math - that’s why they’ll never be able to think for real - and GPUs are sicko good at that kinda math (cause screens are a matrix!). I don’t fuck with LLMs though, no ethics in that whole shitshow.

    Good luck!




  • The best way to run Podman is root with UserNS to dole out UID/GID protection. Running Podman as root allows you to share networks between containers while having the containers run under different users. If you go rootless, you’d need to run under one user to share the user’s network space with all the containers you want.

    As for your issue, I can’t really divine what the problem is from the errors. I avoid nginx because it’s coded to not play well with user abstraction and changing the user with the files it wants to write to etc. Gotta write into a ton of random folders! So not sure exactly what is up. But with Podman root it is easy to run as root 0 internally and make nginx think it has all the control it could ever want.

    Try this setup (it is in Podman Quadlet format, apologies I don’t know the compose versions). It runs the container as root 0 internally, externally it runs as some random UID/GID - secure! It uses Volume idmap to map the internal root 0 user to 1001 for write access to the Volume.

    Note that in Debian 13 symlinks are broken and won’t work with idmap, just point to the original source. If you need symlinks, I have an alternate UserNS that maps internal user root 0 to external user 1001 directly. You’d drop the idmap in Volume then and use that. You lose some extra security - now the container is running as external user 1001 instead of some random UID/GID - but that’s a pretty minor hit as long as your external user doesn’t have access to tons of things.

    # Volumes to mount -> the @ is essential for saying "1001 is absolute and external" basically. 0 is internal. size of 1. You can map 1001 to 0 and 1002 to 1 with @1001-0-2, etc., etc., etc.  
    Volume=/mnt/something:/etc/nginx/wants/to/write/here:rw,noexec,nosuid,nodev,Z,idmap=uids=@1001-0-1;gids=@1001-0-1  
    
    # Run as user running the container  
    UserNS=auto  
    # [use this if req symlink b/c idmap does NOT work with symlinks] -> I tested and it is fixed in at least Podman v5.8.3, so Debian 14 will work with idmap and symlinks directly ! drop the idmap if using !  
    # UserNS=auto:uidmapping=0:@1001:1,gidmapping=0:@1001:1  
    
    # Security time  
    NoNewPrivileges=true  
    # https://man7.org/linux/man-pages/man7/capabilities.7.html  
    DropCapability=all  
    ReadOnly=true  
    ReadOnlyTmpfs=True  
    # These capabilities are needed for linuxserver's s6 "launcher" thing  
    #AddCapability=CAP_CHOWN  
    #AddCapability=CAP_DAC_OVERRIDE  
    #AddCapability=CAP_FOWNER  
    #AddCapability=CAP_SETGID  
    #AddCapability=CAP_SETUID  
    # Needs this if the container tries to bind below port 1024. I'm not sure if it is needed if it only tries to bind internally.  
    #AddCapability=CAP_NET_BIND_SERVICE  
    
    # TempFS for ReadOnly fixes I've used for nginx - may not be relevant for you. These are from getting Frigate running.  
    PodmanArgs=--tmpfs /usr/local/nginx/conf:size=1M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /usr/local/nginx/logs:size=40M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /usr/local/nginx/client_body_temp:size=1M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /usr/local/nginx/proxy_temp:size=1M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /usr/local/nginx/fastcgi_temp:size=1M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /usr/local/nginx/uwsgi_temp:size=1M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /usr/local/nginx/scgi_temp:size=1M,rw,noexec,nosuid,nodev  
    PodmanArgs=--tmpfs /etc/letsencrypt:size=1M,rw,noexec,nosuid,nodev  
    

    Root Podman and UserNS=auto needs a containers user to pull uid/gid from.

    # Root Podman needs a `containers` "user" (not really a user, just a reserved uid/gid space)   [fixt!]  
    #~~sudo echo "containers:2147483647:2147483648" >> /etc/subuid~~  
    #~~sudo echo "containers:2147483647:2147483648" >> /etc/subgid~~  
    echo "containers:2147483647:2147483648" | sudo tee -a /etc/subuid > /dev/null  
    echo "containers:2147483647:2147483648" | sudo tee -a /etc/subgid > /dev/null  
    

    The documentation for Podman is critically lacking in the “hobbyist” space. Hope this helps.

    Edit: This approach works well because most Docker containers are built assuming they’ll run as root 0. That’s why Linuxserver uses the S6 overlay thing to jump from root 0 to something else. The container can be built to run as any user though, if you look at the Dockerfile for the container you’re using, you’ll see what user they’re declaring it will run as (and likely what user owns all the files). Root 0 usually gets around that problem - unless they “cleverly” code it to try to prevent you from running the container as root 0 (I’ve run into this before! It was Heimdall from the Linuxserver people).

    Edit2: I’ve noticed you said no Volumes, so drop that. But you can still use the UserNS mapping to run it as root internally which should fix the internal permissions issues. The tmpfs stuff is if you declare ReadOnly for extra security - it’s a great idea - but nginx is extra difficult in that regard. Disregard it while you get going.

    # Run as user running the container  
    UserNS=auto  
    
    # Security time  
    NoNewPrivileges=true  
    # https://man7.org/linux/man-pages/man7/capabilities.7.html  
    DropCapability=all  
    # These capabilities are needed for linuxserver's s6 "launcher" thing  
    #AddCapability=CAP_CHOWN  
    #AddCapability=CAP_DAC_OVERRIDE  
    #AddCapability=CAP_FOWNER  
    #AddCapability=CAP_SETGID  
    #AddCapability=CAP_SETUID  
    # Needs this if the container tries to bind below port 1024. I'm not sure if it is needed if it only tries to bind internally.  
    #AddCapability=CAP_NET_BIND_SERVICE  
    

    Edit3:
    Use sudo podman top nginx user huser group hgroup groups hgroups to see the internal user/host user (huser) mappings easily for debug.

    USER	HUSER		GROUP	HGROUP		GROUPS	HGROUPS  
    root		2147485695	root		2147485695	105		105  
    

    Here’s an output from my frigate container. Internally (USER) it is root, externally (HUSER) it’s some random UID. I’ve also mapped the internal group (GROUPS) 105 to the external group (HGROUPS) 105 so that it has render access.



  • The docker compose file is great, clear once you get used to all its little sections. For volumes I only use what they call “bind mounts” which are where you have a folder on your system connected to the folder in the container. As opposed to the “docker volumes” which are internal to docker.

    And with those it’s super easy to just be like in the volume subsection:

    - /path/to/local/drive:/container/database:rw,noexec,nosuid,nodev,Z

    - /path/to/network/drive:/container/media:rw,noexec,nosuid,nodev,Z

    The :rw,noexec,nosuid,nodev,Z at the end is a great extra security thing that never causes problems. rw means read-write, you can switch it to ro for read-only if you’ve got something you want the container to only read from but not be able to modify. I use that for jellyfin’s media since I don’t want it doing anything but reading it. The noexec means don’t let executables be run from the folder, never should happen so it just prevents a sick hack from being put in the folder and run. I forget what the others do but they’ve never been a bother. And Z means only one process can access the volume, you can switch it to lower case z to let multiple processes access the volume - and I’m not sure it does anything without SELinux going which I think only fedora does by default right now.

    Enjoy the info dump!


  • Check out BookOrbit if you find Grimmory too hefty in the RAM reqs. It uses very little RAM for me. I think it also has import from Grimmory as well.

    As for the database Q, if you’re using docker/Podman it’ll be very easy to point the database folder (if included in the image, like Jellyfin does) to your local filesystem and the media to your NAS. Same idea if the container uses a Postgres container, just spread across two containers in that case.



  • Oh damn this could replace the bookmakers. I have Linkding with the Linkding Injector extension, but this would be next level.

    You can view the saved text too, nice. Would it be possible to attach an HTML file from like single file for sites that have heavy image content as part of the “view” button? That’d completely replace Linkding/Karakeep/Linkwarden use cases for me

    Understandable if not, that’s ancillary to the text search focus


  • Choose Debian. Real secret reason? Debian means you have to upgrade to new versions less. Ubuntu LTS lasts as long as Debian (5 years) but they crank out a new LTS every 2 years. If you have 3rd party sources, I’ve run into they only support the two latest LTSes - well you have one year left on your 5 year support… but do you really? And now you can put on your sad face because you get to do two LTS upgrades. All while Debian was over there on one version and everyone will target that one version and its previous version no problem.

    Debian just makes better sense for a server.

    (And Ubuntu is stupid with its “ooh extra patches just register your machine with our central authority” ok bud my Debian machine just says I have mail for some reason every time I boot it up, it doesn’t make it weird and gimmicky and based on a “free” deal that could change whenever they want to jerk you around)


  • I use Authentik - works well - but I’m prepping to switch to Authelia for the config-based setup.

    I updated Authentik across 2 versions (they did 2 month-long supported tags, missed one; now they do 3 month-long supported tags) and it destroyed itself. Had to recover the DB from a backup (and then step through the version I tried to skip), and while I was doing that I was like “wait why does this have only a DB? Should just be a config file cause that’s all the depth I do with it” and lo that’s what Authelia is.

    Authentik is audited and Authelia has not been. Initially while I chose Authentik. But config-file robustness in the face of Authentik’s GUI-setup DB imploding swayed me not to care, it’d take so long and be so tedious to redo all my proxies and auths through the GUI. Plus I always forget what to click in the GUI when I come back to add some new program in 4 months.


  • I approach it the same as I did with Docker, one user per container.

    I started with rootless but networking within Podman is moot with multiple users per container. And one user for all containers to get networking has to lead to subUID clashes (and thus escape vectors) - unless someone can explain how not…

    But root Podman is just as secure anyway, and easier, so I just roll with UserNS=auto and use idmap on the volumes to enable writing as the specified user for the container. And networking in Podman works because it’s one user space. By default UserNS=auto gives 1024 subUIDs to a container. I had to up that to 65534 or whatever the max is for Frigate to work. Every other container is cool with the default 1024. The subUIDs are pulled from a user named container that you need to enable for Podman root to work with UserNS, and it has like 2 million or something with their recommended setup, so it’s good.

    It was containers:2147483647:2147483648 into subUID and subgid files

    And I do have a fuckton of users; Debian once complained it ran out of numbers or something after like 20 users, so I just ran the first thing I found to make the UID limit some really big number, and I never thought about it again!