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?

@SheeEttin@lemmy.world
link
fedilink
English
61Y

Just… stop making it accessible from the Internet? Whatever you did to allow it through your firewall, just remove that rule.

@TheQuantumPhysicist@lemmy.world
creator
link
fedilink
English
41Y

I’ve been managing servers for over 10 years, and I never have felt stupider, and I still don’t understand how to do this. Everyone is making a comment that I don’t understand.

Let’s talk internet 101, and please tell me where I’m wrong.

You make a request to https://myservice.example.com. The DNS responds to a query giving you an IP address, say 1.2.3.4. Now the client software makes another request to 1.2.3.4:433 (say if we’re attempting to access an https server, binding the SNI address to the SSL/TLS header). The request will be sent to that server, and the server will respond. In what part of all this process can the VPN can do anything?

Normally if you want to access a device through VPN, you make a request to a WHOLE other ip address in another subnet on another (virtual) device locally. It has absolutely nothing to do with 1.2.3.4. It’s something like 10.10.100.X… or similar. How will my domain, myservice.example.com, route to that address, 10.10.100.X? Is it as dumb and simple as routing there? Or is there more to it? It doesn’t sound right to make the DNS server record point to 10.10.100.X.

@SheeEttin@lemmy.world
link
fedilink
English
21Y

The request will be sent to that server, and the server will respond. In what part of all this process can the VPN can do anything?

If there is a firewall between the client and the server (which there should be), then no, the server will not respond.

The VPN jumps the firewall. When you set up the VPN service, you created firewall rules to allow the VPN traffic. Then when you have the VPN connected, all traffic to the destination network is tunneled through that one connection.

@balance_sheet@lemmy.world
link
fedilink
English
1
edit-2
1Y

I think what you’re looking for is a firewall. Learn about ufw here.

Or, to simply answer your question,

sudo ufw allow from 10.10.100.0/24
sudo ufw enable

Or just use internal ip addr for service.

Create a post

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!

  • 1 user online
  • 62 users / day
  • 99 users / week
  • 232 users / month
  • 844 users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 8.7K Comments
  • Modlog