this post was submitted on 02 Feb 2024
8 points (100.0% liked)

Selfhosted

40173 readers
692 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hi, my current setup is the following

Windows server pc with hyperV (it's a weird choice I know but I wanted to experiment with stuff I'm also using at work) hosting some VMs:

  • OPNSense (doing dhcp server)
  • owncloud (personal cloud)
  • pihole

Till yesterday I had a fix public IP to reach my owncloud via port forwarding from my work laptop and as well my two desktop (outside my network)

Can you suggest a more secure way of doing it? Any general other suggestion to make my setup better?

Thank you

PS: i have no budget constrain but I'm usually not prompt to waste money :D

all 13 comments
sorted by: hot top controversial new old
[–] ShellMonkey@lemmy.socdojo.com 3 points 9 months ago

If you have opnsense in front of it all, using a DDNS client to register the public IP would be step one, then using haproxy for an inbound proxy rather than port forwarding the traffic. That way you could have 'owncloud.your.domain' and 'otherservice.your.domain' hosted on the same IP using 80/443 rather than having to forward random ports in.

[–] Decronym@lemmy.decronym.xyz 1 points 9 months ago* (last edited 9 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
HTTP Hypertext Transfer Protocol, the Web
IP Internet Protocol
SSL Secure Sockets Layer, for transparent encryption
UDP User Datagram Protocol, for real-time communications
nginx Popular HTTP server

4 acronyms in this thread; the most compressed thread commented on today has 11 acronyms.

[Thread #476 for this sub, first seen 2nd Feb 2024, 15:05] [FAQ] [Full list] [Contact] [Source code]

[–] AtariDump@lemmy.world 1 points 9 months ago

More secure way of doing what? Accessing data? Locking down the existing environment? Something else?

I’ve run a similar setup; to me using Hyper-V isn’t weird (especially if you’re trying to mimic a work environment at home to continue learning).

[–] thirdBreakfast@lemmy.world 1 points 9 months ago (2 children)

If this is a question about how to access your server at home from devices anywhere, securely, with a simple setup, then the answer is turn off all that port forwarding, and use Tailscale.

[–] PeroBasta@lemmy.world 2 points 9 months ago

Yesterday I tried installing it on my windows server and it does not run. Like, installation ok, no error, nothing in the sys tray and I can't execute it either

[–] PeroBasta@lemmy.world 1 points 9 months ago

ng a DDNS client to register the public IP would be step one, then using haproxy for an inbound proxy rather than port forwarding the traffic. That way you could have ‘owncloud.your.domain’ and ‘otherservice.your.domain’ hosted on the same IP using 80/443 rather than having to forward random ports in.

I managed to have it run. Horrible the fact that you have to choose between Apple, Microsoft, Google for Tailscale login...

[–] NarrativeBear@lemmy.world 1 points 9 months ago (1 children)

Tailscale would be the most "secure" as you have no ports open and only you can access it. Keep in mind your services will only be accessible by you along as all your devices connect to your tailscale instance. Sharing access is possible but will require some explanation.

Wireguard is another option, just as secure as the first option, it will need one port open but the port only responds if you are connecting with proper keys/authentication. Like tailscale you can only access your services if connected to your wireguard instance.

Reverse Proxy, any version you choose will work, it depends on your preference of layout and user interface. Nginx proxy manager, haproxy, traefik. Each accomplish the same with different levels of setup, I listed them in my ease of use. If you use pfsense as your router haproxy installation is easy and there are plenty of guides about setup. Nginx proxy manager you can also find a bunch of setup videos where it's running on home assistant.

With a reverse proxy you will open port 443 and in your firewall rules point it at your reverse proxy. Your proxy will then direct traffic to any one of your services. You will need a domain name so you can access service1.mydomain.com or service2.mydomain.com from anywhere on the web.

With a reverse proxy and any public website I recommend to run them behind a ddns like CloudFlare. You can do this for free and it helps protect your services against DDoS, bots/crawlers, and it obscures your HomeLab IP, as all incoming traffic goes through CloudFlare and then get directed to your HomeLab.

Additional security that can be implemented within your firewall is to block all traffic not originating from your country, or even only allow specific IP addresses.

I use a combination of all this above where a few services run publicly accessible, and everything else is accessed through tailscale or wireguard. Internally I run haproxy on pfsense where public service are proxied.

I also run nginx proxy manager for my local services, this allows me to access my local services such as service1.local.mydomain.com with a full SSL certificate. So once I connect to my home network with tailscale/wireguard I can type in these domain names into my browser. At some point I will move these into haproxy with its own frontend for internal services.

[–] ShortN0te@lemmy.ml 2 points 9 months ago (1 children)

Tailscale would be the most "secure" as you have no ports open and only you can access it. Keep in mind your services will only be accessible by you along as all your devices connect to your tailscale instance. Sharing access is possible but will require some explanation.

Wireguard is another option, just as secure as the first option, it will need one port open but the port only responds if you are connecting with proper keys/authentication. Like tailscale you can only access your services if connected to your wireguard instance.

I disagree. Tailscale has a much higher attack surface since the network is controlled by a separate entity, tailscale. As on pure wireguard, you would need to first compromise one of your clients to get into the network.

Also tailscale is a much higher value target since you could compromise thousands of devices/networks/communication with 'just' compromising the vendors network.

[–] NarrativeBear@lemmy.world 2 points 9 months ago

You have an excellent point, it seems like tailscale would have a larger attack surface.

I wonder if credentials are hashed in some way on tailscale servers, so even with an attacker gaining access to their servers it would essentially be useless to them.

[–] N0x0n@lemmy.ml -1 points 9 months ago (1 children)

Till yesterday I had a fix public IP to reach my owncloud via port forwarding from my work laptop and as well my two desktop (outside my network)

Disable that port forwarding on your router, and install a wireguard server and forward that port only.

It's free and works like a charm. It's simple and elegant, and I can access all my containers from everywhere in the world!

Dunno your work policies, and what you're allowed to setup or not, but this is the "best way" I know.

[–] PeroBasta@lemmy.world 1 points 9 months ago (1 children)

Any guide you suggest? I don't speak very well "Linux" but I can follow procedures and build on that

[–] N0x0n@lemmy.ml 1 points 9 months ago

It has been a while since I setup my wireguard server, if you host it on a linux system It can be easy as:

  • Install wireguard on your system
  • generate private/public key
  • create a wireguard config file with iptables rules
  • net.ipv4.ip_forward=1 on your server (yeah very important part)
  • open the wireguard UDP port on your router
  • configure clients

The first time you delve into, it can be Intimidating (at that time I was a total CLI/linux noob) if you are a beginner, but I think you will easily find your way :)

This tutorial seems rather complete and easy to follow with comments. Also, if you didn't know, do not blindly copy/past the commands from the web directly in your CLI.