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?
It is that simple. Make the dns entry point to your vpn subnet 10.10.100.X. The way it works is anyone not on your vpn won’t be able to resolve the ip address and will get an error. Anyone on the vpn will be able to resolve the ip address and connect via the vpn connection.
The part people are talking about that is likely confusing you is that if your service is already available via your actual ip address 1.2.3.4 then you have a security concern since anyone can access 1.2.3.4 even without your domain name pointing there. They are encouraging you to make sure your 1.2.3.4 network doesn’t allow access but updating your firewall settings to make sure it blocks connections that are not made via your vpn subnet of 10.10.100.X
Thank you for the clarification. I’ll give that a shot. Cheers!