jsshapiro
Occasional Visitor
Part 1: Context and Goal
In early 2019, Ed B. posted his Ultimate Guide to setting up a bi-directional VPN using ASUS routers. He did a fantastically thorough job describing what he did. Most of it is right, and you should use his post as a place to get started. Unfortunately, he got a critical OpenVPN setting wrong in a way that creates a serious security hole. And even more unfortunately, his solution only works because of that security hole. This stuff is hard, and I'm really impressed with Ed's effort. After playing with it for a good chunk of today I was able to get a solution running that actually works. The solution here should work for any router running WRT, but I can't speak to how the user interfaces on other routers may look. I got it working on recent ASUS WIFI routers (RT-AC3100 and RT-AC5300). I don't have any of the VPN fusion devices, so I cannot test that.
Let's start by describing what we're trying to accomplish in our case. We have four "sites" that we want to interconnect:
In addition, we have a number of people who connect in from individual machines using OpenVPN client software. Once connected over OpenVPN, we want these machines to be able to reach any machine on any site, but we do not want these individual hosts spreading VPN packets on to their local networks. Extending the VPN into a random coffee shop sort of defeats the purpose of the VPN.
We want all connections to be using a client-side certificate (the one in their .ovpn file).
Bonus: We want a way to retire old certificates in a phased way, so that we can set up a new certificate configuration, migrate the client node, and then discard the old one.
Bonus: if we want to, the approach described here will let us assign different certificates to each of the dial-up users, which allows us to retire those certificates promptly when someone who has access decides to take a different job.
Bonus: It appears that this approach can be extended. If we end up with two many client simultaneous connections to our main facility router, it looks like we can use the second site as an alternative if we are willing to fiddle with the route push configurations. Since we haven't had a need for it, I haven't looked in to that. Honestly, if we hit the point where we need to support that many simultaneous client connections, it's time to go for a business-grade VPN solution.
The key to all of this is that we're going to generate distinct client certificates for each of the sites. That's the piece that Ed B. didn't do. It's why he couldn't get the site-to-site mode working without setting "Username/Password Auth Only" to "yes'. When this is done, OpenVPN "fakes" some information that it would normally get from the client certificate, which is why he was able to set up a site-to-site configuration with this enabled. Unfortunately, when Ed set that to yes, he unintentionally bypassed a key part of the OpenVPN connection security handshake.
The bad news is that the WRT interface doesn't provide a way to generate individual client certificates. The good news is that all of the tools you need to do it are sitting on the router, and it this isn't that hard if you know how to drive a text editor.
A bunch of people were trying to solve this with iptables, but it's actually an OpenVPN issue. The necessary facts are documented (after a fashion) on the OpenVPN site, but putting them together to know what to do, and then figuring out how to do them on the darned router took some doing.
In early 2019, Ed B. posted his Ultimate Guide to setting up a bi-directional VPN using ASUS routers. He did a fantastically thorough job describing what he did. Most of it is right, and you should use his post as a place to get started. Unfortunately, he got a critical OpenVPN setting wrong in a way that creates a serious security hole. And even more unfortunately, his solution only works because of that security hole. This stuff is hard, and I'm really impressed with Ed's effort. After playing with it for a good chunk of today I was able to get a solution running that actually works. The solution here should work for any router running WRT, but I can't speak to how the user interfaces on other routers may look. I got it working on recent ASUS WIFI routers (RT-AC3100 and RT-AC5300). I don't have any of the VPN fusion devices, so I cannot test that.
Let's start by describing what we're trying to accomplish in our case. We have four "sites" that we want to interconnect:
- Site A: Our main facility. This will act as our "hub."
- Site B: Our administrative offices
- Site C: the home of one of our developers
- Site D: a private Kubernetes cluster running at a cloud-based cluster provider. This part isn't solved by what I'm going to write here - we're still working on it.
In addition, we have a number of people who connect in from individual machines using OpenVPN client software. Once connected over OpenVPN, we want these machines to be able to reach any machine on any site, but we do not want these individual hosts spreading VPN packets on to their local networks. Extending the VPN into a random coffee shop sort of defeats the purpose of the VPN.
We want all connections to be using a client-side certificate (the one in their .ovpn file).
Bonus: We want a way to retire old certificates in a phased way, so that we can set up a new certificate configuration, migrate the client node, and then discard the old one.
Bonus: if we want to, the approach described here will let us assign different certificates to each of the dial-up users, which allows us to retire those certificates promptly when someone who has access decides to take a different job.
Bonus: It appears that this approach can be extended. If we end up with two many client simultaneous connections to our main facility router, it looks like we can use the second site as an alternative if we are willing to fiddle with the route push configurations. Since we haven't had a need for it, I haven't looked in to that. Honestly, if we hit the point where we need to support that many simultaneous client connections, it's time to go for a business-grade VPN solution.
The key to all of this is that we're going to generate distinct client certificates for each of the sites. That's the piece that Ed B. didn't do. It's why he couldn't get the site-to-site mode working without setting "Username/Password Auth Only" to "yes'. When this is done, OpenVPN "fakes" some information that it would normally get from the client certificate, which is why he was able to set up a site-to-site configuration with this enabled. Unfortunately, when Ed set that to yes, he unintentionally bypassed a key part of the OpenVPN connection security handshake.
The bad news is that the WRT interface doesn't provide a way to generate individual client certificates. The good news is that all of the tools you need to do it are sitting on the router, and it this isn't that hard if you know how to drive a text editor.
A bunch of people were trying to solve this with iptables, but it's actually an OpenVPN issue. The necessary facts are documented (after a fashion) on the OpenVPN site, but putting them together to know what to do, and then figuring out how to do them on the darned router took some doing.
Last edited: