Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
dweepus
Nov 25, 2021
Recently spun up a small Debian server and I have a few docker containers running on it. In the future I will probably want it to be accessible by friends and family, on devices where wireguard won't be usable. Reading this thread I can tell I will need to set up a domain and nginx reverse proxy with NPM. Beyond that, I like the idea of segregating this server from the rest of my network, but I don't like how my router would handle a DNS (allow all traffic to the server and separate it from the internal network, throwing it to the wolves). On the other hand, my router does have a packet filtering option. Would it be secure/wise to use that to block the server from initiating connections to any other local devices? In the event that the server is compromised, that is.

Adbot
ADBOT LOVES YOU

Mr. Crow
May 22, 2008

Snap City mayor for life
If your server isn't on a separate network (subnet) its not going to matter, traffic is gonna bypass it at layer 2 (unless it also acts as your switch), but otherwise thats how DMZs work yes.

dweepus
Nov 25, 2021
It is one of those all in one router/gateway type deals from my ISP, so I suppose it does act as a switch for my network? I may move the server to another unmanaged switch that is attached to the same router but overall it's a very simple network, nothing fancy.

dweepus fucked around with this message at 00:34 on Sep 29, 2023

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



If you're doing all this in docker containers you can setup docker networks between your containers and NPM so they have seperate subnets from your LAN. It also has the benefit of letting the docker network act as a dns server so you can point NPM to an internal domain rather than an IP.



An example couple of compose files would be:

code:
version: "3"
services:
  5etools-docker:
    container_name: 5etools-docker
    image: jafner/5etools-docker
    volumes:
      - /home/server/5etools:/usr/local/apache2/htdocs
#    ports:
#     - 5555:80/tcp
    networks:
      - 5etools_backend
    environment:
     - SOURCE=GITHUB
    restart: unless-stopped
networks:
  5etools_backend:
    name: 5etools_backend
code:
version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    networks:
      - npm_private_network
      - 5etools_backend
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: ${SQLURS}
      DB_MYSQL_PASSWORD: ${SQLPASS}
      DB_MYSQL_NAME: ${SQLURS}
    volumes:
      - /home/server/NGINX/data:/data
      - /home/server/NGINX/letsencrypt:/etc/letsencrypt
  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    networks:
      - npm_private_network
    environment:
      MYSQL_ROOT_PASSWORD: ${SQLROOTPASS}
      MYSQL_DATABASE: ${SQLURS}
      MYSQL_USER: ${SQLURS}
      MYSQL_PASSWORD: ${SQLPASS}
    volumes:
      - /home/server/nginxdb:/var/lib/mysql

networks:
  npm_private_network:
    name: npm_private_network
  5etools_backend:
    name: 5etools_backend

Nitrousoxide fucked around with this message at 00:49 on Sep 29, 2023

dweepus
Nov 25, 2021
Admittedly I am still learning about how to implement docker but something like that was definitely on my to-do list. My question was more about what if an attacker had already escaped the container and attempted to hop from my server to another device, but maybe I am just being paranoid at that point. At the least I plan to run each container with minimal and segregated privileges, only allow the containers that need to communicate with each other to do so, implement fail2ban, and probably set up some nftables rules to limit incoming connections. I suppose it's really a matter of finding where the line is between not enough and overkill for practical purposes.

Mr. Crow
May 22, 2008

Snap City mayor for life

Nitrousoxide posted:

If you're doing all this in docker containers you can setup docker networks between your containers and NPM so they have seperate subnets from your LAN. It also has the benefit of letting the docker network act as a dns server so you can point NPM to an internal domain rather than an IP.



An example couple of compose files would be:

code:
version: "3"
services:
  5etools-docker:
    container_name: 5etools-docker
    image: jafner/5etools-docker
    volumes:
      - /home/server/5etools:/usr/local/apache2/htdocs
#    ports:
#     - 5555:80/tcp
    networks:
      - 5etools_backend
    environment:
     - SOURCE=GITHUB
    restart: unless-stopped
networks:
  5etools_backend:
    name: 5etools_backend
code:
version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    networks:
      - npm_private_network
      - 5etools_backend
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: ${SQLURS}
      DB_MYSQL_PASSWORD: ${SQLPASS}
      DB_MYSQL_NAME: ${SQLURS}
    volumes:
      - /home/server/NGINX/data:/data
      - /home/server/NGINX/letsencrypt:/etc/letsencrypt
  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    networks:
      - npm_private_network
    environment:
      MYSQL_ROOT_PASSWORD: ${SQLROOTPASS}
      MYSQL_DATABASE: ${SQLURS}
      MYSQL_USER: ${SQLURS}
      MYSQL_PASSWORD: ${SQLPASS}
    volumes:
      - /home/server/nginxdb:/var/lib/mysql

networks:
  npm_private_network:
    name: npm_private_network
  5etools_backend:
    name: 5etools_backend

Pretty sure this doesnt do what you think it does, unless you're also doing some external firewall iptables magic you didn't list. Docker networks are basically just a NAT, the containers still have full RFC 1918 access. The host acts as a gateway.

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



Mr. Crow posted:

Pretty sure this doesnt do what you think it does, unless you're also doing some external firewall iptables magic you didn't list. Docker networks are basically just a NAT, the containers still have full RFC 1918 access. The host acts as a gateway.

Yeah, I misunderstood what they wanted. This will separate the containers from each other, and they won't have access to a direct IP connection to another container except through the reverse proxy. However, they will still have access to the whole LAN. You'll want a separate DMZ that your services live on to get true network separation from the rest of your LAN.

dweepus
Nov 25, 2021
I guess my real question is: is putting this server in a DMZ "necessary" (to the extent of reasonable security, not exactly fort knox over here), or am I worrying too much and container hardening + locking down authentication is sufficient? I realize its kind of subjective but it's been a few years since my formal network security education and I'm a bit rusty on where the lines between theoretical and practical lie.

Mr. Crow
May 22, 2008

Snap City mayor for life
Depends entirely what you're comfortable with and what the services are. I wouldn't with just what we've talked about so far but I probably wouldn't have much of a problem if I was running SELinux + Podman + configured the host to block local network access from the container network. Also making sure the containers are hardened sonewhat.

I don't think docker can do that with any flags, podman might but you can just do it with your hosts firewall https://stackoverflow.com/questions/72037768/how-to-prevent-docker-containers-from-accessing-my-local-network

Also I wouldn't trust some ISP or consumer router, they rarely patch out vulnerabilities and even when they do many have laughably short support cycles, but I'm also paranoid. See e.g. https://www.tomsguide.com/news/router-attack-netusb-flaw you can use something like opnsense or openwrt or pfsense and with some basic maintenance have a secure gateway basically for the life of the hardware.

Mr. Crow fucked around with this message at 03:09 on Sep 29, 2023

cruft
Oct 25, 2007

Mr. Crow posted:

Also I wouldn't trust some ISP or consumer router, they rarely patch out vulnerabilities and even when they do many have laughably short support cycles, but I'm also paranoid.

I agree with this and I don't consider myself paranoid. I did incident response for 15 years, though, and I have Seen Some poo poo.

Dyscrasia
Jun 23, 2003
Give Me Hamms Premium Draft or Give Me DEATH!!!!
I think clarification is needed here too because I read a comment about an emby exploit.... I'd never expose a service directly to the Internet. Put a reverse proxy with authentication in front of it(or your choice of VPN etc)

Dyscrasia fucked around with this message at 04:19 on Sep 29, 2023

dweepus
Nov 25, 2021
So when you say authentication in front of the reverse proxy, do you mean Login Prompt > Nginx proxy > Jellyfin login prompt? So having an authentication layer on both sides of the reverse proxy?

Also having done more research I do feel a bit more comfortable with putting the server in a DMZ. It seems to me that the stipulation with doing that is being very thorough with a firewall on the host itself.

ToxicFrog
Apr 26, 2008


Dyscrasia posted:

I think clarification is needed here too because I read a comment about an emby exploit.... I'd never expose a service directly to the Internet. Put a reverse proxy with authentication in front of it(or your choice of VPN etc)

It looks like the Emby bug is basically: if you have "permit local network login without password" turned on (so users on the LAN can just click their username), and you have it configured for reverse proxy deployment (so it reads the X-Forwarded-For: header), and you don't actually have it behind a reverse proxy but instead directly facing the internet, any rando can just send it an HTTP request with X-Forwarded-For: 127.0.0.1 and get passwordless login.

Dyscrasia
Jun 23, 2003
Give Me Hamms Premium Draft or Give Me DEATH!!!!

dweepus posted:

So when you say authentication in front of the reverse proxy, do you mean Login Prompt > Nginx proxy > Jellyfin login prompt? So having an authentication layer on both sides of the reverse proxy?

Also having done more research I do feel a bit more comfortable with putting the server in a DMZ. It seems to me that the stipulation with doing that is being very thorough with a firewall on the host itself.

More or less. I'd probably turn off the emby authentication and force all traffic through the reverse proxy. I don't trust services like emby or the *arrs to properly implement authentication. I use emby myself, but only on the local network. I'd be doing tailscale if I needed remote access.

dweepus
Nov 25, 2021
Makes sense. Currently for what I want externally accessible (eventually) it's just jellyfin and navidrome. Internally I will want access to pihole, *arrs, Heimdall, etc. All of these are in containers on the same box. If I put auth in front of Nginx, how would that affect app clients connecting to those services, notably smart tv apps?

Warbird
May 23, 2012

America's Favorite Dumbass

Is there anyone here I can pick the brains on for Synology or regular networking nonsense?

I recently started using IDrive for offsite backups and they provide a Syn native application that "just works". This is all well and good, but it is architected to run via a web portal using the Syn native webserver (Apache iirc) and lives as a subdomain, [nas domain]/IDrive. The issue here is that my Reverse Proxy (again, Syn native. NGX iirc) isn't having it when I try to access it via the domain and I have to use [NAS IP]/IDrive to go about my business. Not a major issue, but an annoying one.

Does anyone have a notion as to what might be causing the issue? The web service has an alias set up so [domain]/subdirectory ought to work same as it would for the photo service.

Mr. Crow
May 22, 2008

Snap City mayor for life

dweepus posted:

Makes sense. Currently for what I want externally accessible (eventually) it's just jellyfin and navidrome. Internally I will want access to pihole, *arrs, Heimdall, etc. All of these are in containers on the same box. If I put auth in front of Nginx, how would that affect app clients connecting to those services, notably smart tv apps?

Just use a VPN

THF13
Sep 26, 2007

Keep an adversary in the dark about what you're capable of, and he has to assume the worst.
Auth in front of nginx, be it Authelia, Authentik, basicAuth, Cloudflare tunnel 2step, whatever will break smart tvs and mobile apps connecting to emby/jellyfin.
Tailscale is available on apple TVs now, so it may be more practical to "just use a VPN" then it used to be for AppleTV/Android based set top boxes.

cruft
Oct 25, 2007

THF13 posted:

Auth in front of nginx, be it Authelia, Authentik, basicAuth, Cloudflare tunnel 2step, whatever will break smart tvs and mobile apps connecting to emby/jellyfin.
Tailscale is available on apple TVs now, so it may be more practical to "just use a VPN" then it used to be for AppleTV/Android based set top boxes.

HTTPS with basic auth is a heck of a lot easier to set up, and will get you a pretty decent bump in overall security stance.

I don't even remember who asked about this, but HTTP basic isn't a bad move.

THF13
Sep 26, 2007

Keep an adversary in the dark about what you're capable of, and he has to assume the worst.
I do like putting some kind of auth, even http basic auth in front of services, but it too will break Emby/Jellyfin smart tv/mobile apps.
There's a couple of self hosted type services that will let you specify a basic auth user/password and their own user/password, but not these. Well afaik, not super up to date with Jellyfin's apps.

Dyscrasia
Jun 23, 2003
Give Me Hamms Premium Draft or Give Me DEATH!!!!
Ah shoot, in that case it's VPN all the way from my opinion.

FAT32 SHAMER
Aug 16, 2012



I’m looking at getting a video doorbell and maybe a couple outdoor cameras that are preferably PoE so I don’t have to deal with batteries or snow blocking solar rechargers. I stumbled upon [url= https://github.com/blakeblackshear/frigate]Frigate[/url], which seems really cool + good.

one big thing I’d really like is to integrate it with HomeKit, mostly so most of the annoyance is front loaded with the install + config/server shenanigans and I don’t have to deal with lovely apps and stuff like that. I’m assuming goons have probably hosed around with stuff like this, so any pointers would be super helpful :)

Warbird
May 23, 2012

America's Favorite Dumbass

Is there a SQL Server Management for Idiots out there? I have one doing things for a handful of services and I haven’t really touched it. I probably should do backups or the like.

Coxswain Balls
Jun 4, 2001

How are the self-hosted alternatives to Google Photos doing these days? I've been using it since it came with my Pixel phone but the free unlimited storage has long since expired, and I told myself that once I started getting close to the storage limit I'd finally get off of it and roll my own. The thing I like the most is being able to search "birds" and get all my pictures of birds using whatever ML algorithm they're using. With AI stuff becoming more widespread is that something alternatives are able to do these days? I'll probably be running it on my TrueNAS box.

TraderStav
May 19, 2006

It feels like I was standing my entire life and I just sat down

Coxswain Balls posted:

How are the self-hosted alternatives to Google Photos doing these days? I've been using it since it came with my Pixel phone but the free unlimited storage has long since expired, and I told myself that once I started getting close to the storage limit I'd finally get off of it and roll my own. The thing I like the most is being able to search "birds" and get all my pictures of birds using whatever ML algorithm they're using. With AI stuff becoming more widespread is that something alternatives are able to do these days? I'll probably be running it on my TrueNAS box.

I've heard immich is really really good but haven't tried installing it. In the process of trying to get my Google takeout photos into a place to import into a new platform (combining the json with the date and exif data) and am trying Memories in Nextcloud as a replacement. Will let you know how it goes.

Motronic
Nov 6, 2009

Coxswain Balls posted:

How are the self-hosted alternatives to Google Photos doing these days? I've been using it since it came with my Pixel phone but the free unlimited storage has long since expired, and I told myself that once I started getting close to the storage limit I'd finally get off of it and roll my own. The thing I like the most is being able to search "birds" and get all my pictures of birds using whatever ML algorithm they're using. With AI stuff becoming more widespread is that something alternatives are able to do these days? I'll probably be running it on my TrueNAS box.

I'm still using NextCloud and their terrible photo browser on a computer and "Les Pas" on my phone. It's not a great solution.

I haven't tried immich in a while. It's very promising, but very incomplete. It's probably worth a try for you )(and for me to see how far they've gotten since the last time I tried it).

The more mature one is PhotoPrism. Which bafflingly doesn't have any concept of "users". There were also some other annoyances that may have risen to the level of deal killer for me, but I don't recall them. It may very well work for you - we've all got different requirements.

TraderStav
May 19, 2006

It feels like I was standing my entire life and I just sat down

Motronic posted:

I'm still using NextCloud and their terrible photo browser on a computer and "Les Pas" on my phone. It's not a great solution.

I haven't tried immich in a while. It's very promising, but very incomplete. It's probably worth a try for you )(and for me to see how far they've gotten since the last time I tried it).

The more mature one is PhotoPrism. Which bafflingly doesn't have any concept of "users". There were also some other annoyances that may have risen to the level of deal killer for me, but I don't recall them. It may very well work for you - we've all got different requirements.

Check out memories for NC, it's quite nice

FAT32 SHAMER
Aug 16, 2012



I still haven’t gotten around to figuring out how to dump iCloud Photos onto my nas as a physical backup. I’m extremely annoyed macOS requires the photos library to be stored on the local drive instead of a network drive, otherwise I’d be golden

Keito
Jul 21, 2005

WHAT DO I CHOOSE ?

Coxswain Balls posted:

How are the self-hosted alternatives to Google Photos doing these days? I've been using it since it came with my Pixel phone but the free unlimited storage has long since expired, and I told myself that once I started getting close to the storage limit I'd finally get off of it and roll my own. The thing I like the most is being able to search "birds" and get all my pictures of birds using whatever ML algorithm they're using. With AI stuff becoming more widespread is that something alternatives are able to do these days? I'll probably be running it on my TrueNAS box.

I've been using Immich for a couple of months now. It does run local ML stuff in a sidecar to classify images. Two users, auth via OIDC, sync from phones.

Had trouble with some of the initial uploads from iPhone an (like 3-4 photos IIRC) getting corrupted when the phone turned off its screen mid transfer, before I figured out how to disable that timeout, but it was a bit disappointing that Immich treated those uploads interrupted uploads as if they were successful and prevented reuploads because the (non-corrupted) file hashes are registered for those entries in its database. Definitely still some rough edges, but the project is coming along nicely. iPhone background syncing is not working great.

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



Warbird posted:

Is there a SQL Server Management for Idiots out there? I have one doing things for a handful of services and I haven’t really touched it. I probably should do backups or the like.

If you're running the SQL server in a docker/podman container I'd just stop the container and back up the data volumes. It might be a bit bigger than it strictly needs to be from a proper sql dump, but you should never need to worry about learning the underlying sql tool.

I run a bit more risky and do live backups of the database containers without stopping them. Hasn't failed me yet, but I imagine some day it will catch the database in the middle of a write and gently caress me over. I figure I can just roll back an extra day (since I do daily backups) and just deal with the day of data loss so I don't have to orchestrate shutting down and restarting the containers from my backup solution (dupliciti).

Motronic
Nov 6, 2009

TraderStav posted:

Check out memories for NC, it's quite nice

Wow, thanks! I did almost nothing other than install and index - it's using all the preview generation and face rec I already had. It's so much better than "Photos". How is this not the default photo app in NC?

Warbird
May 23, 2012

America's Favorite Dumbass

Nitrousoxide posted:

If you're running the SQL server in a docker/podman container I'd just stop the container and back up the data volumes. It might be a bit bigger than it strictly needs to be from a proper sql dump, but you should never need to worry about learning the underlying sql tool.

I run a bit more risky and do live backups of the database containers without stopping them. Hasn't failed me yet, but I imagine some day it will catch the database in the middle of a write and gently caress me over. I figure I can just roll back an extra day (since I do daily backups) and just deal with the day of data loss so I don't have to orchestrate shutting down and restarting the containers from my backup solution (dupliciti).

Oh huh, I hadn’t considered that. Iirc it’s just in some LXC setup from turnkey so I could likely automate that all in Proxmox. Hell, I should go see if Turnkey bundled some stuff in.

TraderStav
May 19, 2006

It feels like I was standing my entire life and I just sat down

Motronic posted:

Wow, thanks! I did almost nothing other than install and index - it's using all the preview generation and face rec I already had. It's so much better than "Photos". How is this not the default photo app in NC?

There's some other things to set up for handling places (geolocation) and some other things. But it's really solid. Save the bookmark to your desktop and it's basically an app

Motronic
Nov 6, 2009

TraderStav posted:

There's some other things to set up for handling places (geolocation) and some other things. But it's really solid. Save the bookmark to your desktop and it's basically an app

Yeah, I got the geolocation download thing too when I was indexing. Very painless, everything appears to Just Work(tm).

E: I thought all those previews I'd been processing forever were supposed to make things scroll smoother, but it turns out the Photos app is just permanently broken. So far, that's the biggest upgrade with this Memories app......it scrolls just fine on a timeline like google photos. And has done a fine job of ripping off "1 year ago, 5 years ago" too.

Motronic fucked around with this message at 18:34 on Oct 4, 2023

Nitrousoxide
May 30, 2011

do not buy a oneplus phone



Warbird posted:

Oh huh, I hadn’t considered that. Iirc it’s just in some LXC setup from turnkey so I could likely automate that all in Proxmox. Hell, I should go see if Turnkey bundled some stuff in.

If your VM's storage is on ZFS storage you can use the "snapshot" mode in a backup task (one of the options under your proxmox cluster's datacenter) which will only pause the VM for a second or two while it snapshots the storage's current state. Then it'll run the backup on that state while it keeps running. Otherwise if it's not on ZFS storage you can have it suspend or shut down the vm for the backup. This obviously takes it down longer.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

TraderStav posted:

I've heard immich is really really good but haven't tried installing it. In the process of trying to get my Google takeout photos into a place to import into a new platform (combining the json with the date and exif data) and am trying Memories in Nextcloud as a replacement. Will let you know how it goes.

What are you using to combing the json and exif data? Been wanting to do a Google Takeout of my photos to make a backup of them.

Warbird
May 23, 2012

America's Favorite Dumbass

Nitrousoxide posted:

If your VM's storage is on ZFS storage you can use the "snapshot" mode in a backup task (one of the options under your proxmox cluster's datacenter) which will only pause the VM for a second or two while it snapshots the storage's current state. Then it'll run the backup on that state while it keeps running. Otherwise if it's not on ZFS storage you can have it suspend or shut down the vm for the backup. This obviously takes it down longer.



You know, I don't honestly know. I set up this PMox instance years ago just to try it out and have been meaning to get around to wiping it out and resetting it up with intention.

Hughlander
May 11, 2005

Motronic posted:

I'm still using NextCloud and their terrible photo browser on a computer and "Les Pas" on my phone. It's not a great solution.

I haven't tried immich in a while. It's very promising, but very incomplete. It's probably worth a try for you )(and for me to see how far they've gotten since the last time I tried it).

The more mature one is PhotoPrism. Which bafflingly doesn't have any concept of "users". There were also some other annoyances that may have risen to the level of deal killer for me, but I don't recall them. It may very well work for you - we've all got different requirements.

NextCloud background upload of photos on iOS is really crap everytime I looked at it. Like it never finished the initial sync from an iPhone. I'd love something that 'just worked' I've taken to just having my wife on a spare Apple Mini that gets iCloud drive photos + time machine to my NAS but it still sucks.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

For those wanting a more barebones gallery, I've been shocked by how smooth PiGallery2 is.

Unlike most of the other more featureful services, it doesn't need to take control of your photo uploads. Just give it read-only access to your pictures folder and it works, so you can replace it at any time. Upload your photos via whatever app you are already using to sync everything else (I use round-sync/rclone).

Adbot
ADBOT LOVES YOU

Motronic
Nov 6, 2009

Hughlander posted:

NextCloud background upload of photos on iOS is really crap everytime I looked at it. Like it never finished the initial sync from an iPhone. I'd love something that 'just worked' I've taken to just having my wife on a spare Apple Mini that gets iCloud drive photos + time machine to my NAS but it still sucks.

It has had the same issues on android and they always come down to "the OS or app updated and now the background/power saving stuff is messed up AGAIN".

I believe I mentioned this in the automation thread, but the way to fix ALL of this on android is to diable the very broken "doze" mode that has been added in the last year or few. "adb shell dumpsys deviceidle disable" And no, of course it doesn't persist a reboot.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply