this post was submitted on 13 Aug 2023
33 points (94.6% liked)

Selfhosted

51415 readers
873 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 2 years ago
MODERATORS
 

Say I have a public server with a service (email, web server, etc) that's accessible through https://myservice.example.com, and I would like to restrict that service with a VPN. How do I do that?

I know how to setup a VPN. I know how to use some of the services through that VPN. But see, if I want to use that VPN, I connect my client to that VPN, then I get the subnet of that VPN, say 10.10.100.0, through which I can access the devices by address.

But I see some services offer things like https://myservice.example.com, and they only work when that VPN is connected. How does that work? Is it just some DNS setting at the domain level or there's more to it?

you are viewing a single comment's thread
view the rest of the comments
[–] TheQuantumPhysicist@lemmy.world 1 points 2 years ago (8 children)

But what about the domain name association? How is that done?

[–] InvertedParallax@lemm.ee 2 points 2 years ago (7 children)

Same as the public one, just with an internal address.

Have this on my domain, public domain with a subdomain server behind VPN and 1 host that points to an internal address.

Anyone tries to reach from outside just times out or something.

DNS is just a lookup of names to numbers, that's all it is, the numbers can be anything, I can point my domain to Google if I want.

[–] TheQuantumPhysicist@lemmy.world 1 points 2 years ago* (last edited 2 years ago) (6 children)

Please elaborate a little more. So assuming the server where the service lies has IP address 1.2.3.4, and some VPN that I can connect to with 1.2.3.4:1194. If my DNS server points to 1.2.3.4, and say there's an http server there that's normally accessible with 1.2.3.4:80, how will we enforce that working only through VPN?

[–] InvertedParallax@lemm.ee 1 points 2 years ago

There's an internal ip address for the VPN server, say 4.3.2.1, you point the http dns record to that address.

The VPN server has 2 addresses by definition, an internal address and an external, public one that you connect the VPN to. Make sure the webserver only exposes itself on the private address, either by configuration (nginx/apache listen address) or by firewall (iptables -A input -j DROP)

load more comments (5 replies)
load more comments (5 replies)
load more comments (5 replies)