386.3 will introduce a complete overhaul of the OpenVPN routing handling, serving as the platform on top of which is implemented the new VPN Director.
Backend changes:
Starting with 386.3, all OpenVPN routing will now be directly configured by the firmware itself, rather than having the OpenVPN client create routes, and having the firmware modify them afterward. The biggest benefit of this method is that routing handling will be cleaner, no more need to remove unwanted routes that were pushed by the server. The vpnrouting.sh script is gone, the routing handlers are now implemented within libovpn, making it more robest and more flexible.
The new implementation allows the "Redirect Internet Traffic" option to behave more accurately, as it will no longer be silently overriden by the remote server. If you set it to "No" and that remote server tries to push itself as the new default gateway, that route will not be configured.
With the new implementation there is no longer a separate Policy Rule and Policy Rule (Strict) method - just one single Policy Rule.
Killswitch behaviour has also changed a bit, now when you manually stop a client by turning it off on the webui (or by manually running a "service stop_vpnclientX" command over SSH), the killswitch will not be activated. The killswitch is now activated in these scenarios:
- If a VPN client is set to connect at boot time AND the killswitch is enabled, then the killswitch is applied at boot time until that client connects
- If a VPN client is abnormally terminated (for example if you kill the openvpn process), or another connectivity issue that causes the down-handler to be executed, but NOT the regular "stop_client" code in the firmware.
Another benefit of the new implementation is that the killswitch can also be used in "Redirect All" mode now, not just in policy mode.
This allows me to introduce the new feature that sits on top of this: VPN Director.
VPN Director replaces the original policy-based routing implementation. It's a bit closer in design to Asus' VPN Fusion, meaning that all rules are now configured in a central location. However it's still only limited to OpenVPN - PPTP and L2TP clients are not supported.
This feature is accessed through a new VPN Director page, in the VPN section. There, you can create rules (up to 199 rules total), and assign which VPN tunnel should be accessed by it (or WAN if you want to override it). That page will also show you a summary of your current OpenVPN setup, and allow you to start/stop clients directly from it.
Notes about VPN Director:
Changes in custom settings storage
Another noteworthy change in 386.3 is that the custom config entries for OpenVPN clients and servers are now stored in JFFS instead of base64-encoded nvram. This allows to greatly increase the maximum amount of config lines, from ~380 characters to close to 3999 characters now.
IMPORTANT:
Make a backup of both your settings AND JFFS partition before flashing 386.3! First, because first boot will convert existing rules into VPN Director rules, as well as migrating the custom configuration entries. If you go back, you will need to either re-enter your rules and custom VPN configs, or restore a backup of your settings. Also, in case something goes wrong during the first boot import process, which may require a factory default reset (it happened to me during development, and while I fixed the bug that caused this, there's always a chance that there is another bug still in there - that's what testing is for).
Test builds are available in the VPN Director folder, at https://www.asuswrt-merlin.net/test-builds/
Things to test:
Thanks everyone!
Backend changes:
Starting with 386.3, all OpenVPN routing will now be directly configured by the firmware itself, rather than having the OpenVPN client create routes, and having the firmware modify them afterward. The biggest benefit of this method is that routing handling will be cleaner, no more need to remove unwanted routes that were pushed by the server. The vpnrouting.sh script is gone, the routing handlers are now implemented within libovpn, making it more robest and more flexible.
The new implementation allows the "Redirect Internet Traffic" option to behave more accurately, as it will no longer be silently overriden by the remote server. If you set it to "No" and that remote server tries to push itself as the new default gateway, that route will not be configured.
With the new implementation there is no longer a separate Policy Rule and Policy Rule (Strict) method - just one single Policy Rule.
Killswitch behaviour has also changed a bit, now when you manually stop a client by turning it off on the webui (or by manually running a "service stop_vpnclientX" command over SSH), the killswitch will not be activated. The killswitch is now activated in these scenarios:
- If a VPN client is set to connect at boot time AND the killswitch is enabled, then the killswitch is applied at boot time until that client connects
- If a VPN client is abnormally terminated (for example if you kill the openvpn process), or another connectivity issue that causes the down-handler to be executed, but NOT the regular "stop_client" code in the firmware.
Another benefit of the new implementation is that the killswitch can also be used in "Redirect All" mode now, not just in policy mode.
This allows me to introduce the new feature that sits on top of this: VPN Director.
VPN Director replaces the original policy-based routing implementation. It's a bit closer in design to Asus' VPN Fusion, meaning that all rules are now configured in a central location. However it's still only limited to OpenVPN - PPTP and L2TP clients are not supported.
This feature is accessed through a new VPN Director page, in the VPN section. There, you can create rules (up to 199 rules total), and assign which VPN tunnel should be accessed by it (or WAN if you want to override it). That page will also show you a summary of your current OpenVPN setup, and allow you to start/stop clients directly from it.
Notes about VPN Director:
- For VPN rules related to OpenVPN instances to be applied, that instance must be set to Policy mode. (I might eventually rename that to "VPN Director" to make it clearer?)
- It more clearly shows how each rules interact with one another. Highest priority will be any client set to redirect all traffic, followed by WAN rules, and then followed by OpenVPN rules, with OpenVPN 1 having the highest priority, and OpenVPN 5 the lowest (last) priority. Also note that Dual WAN routes have a higher priority than all of this.
- Rules are now stored in JFFS rather than nvram, allowing us to store more rules, and also save a good bit of nvram even when rules weren't used. There should now be enough space to store 199 rules total (unless you use insanely long descriptions for each rules), while the previous implementation would often run out of space before hitting the established limit of 100 per client.
- Rules can now be disabled/enabled through the web interface, without the need of removing/adding them. You can just click on the ckeckmark to disable it (but don't forget to Apply your changes afterward!)
- Just like before, local/remote IPs can be entered in CIDR format if you want to specify a range.
- Rules can be updated without needing to restart the VPN client. Once you click Apply, rules are applied to the RPDB tables.
- Existing rules will be imported into VPN Director on first boot. However if you revert back to a previous firmware release, your rules will be gone.
Changes in custom settings storage
Another noteworthy change in 386.3 is that the custom config entries for OpenVPN clients and servers are now stored in JFFS instead of base64-encoded nvram. This allows to greatly increase the maximum amount of config lines, from ~380 characters to close to 3999 characters now.
IMPORTANT:
Make a backup of both your settings AND JFFS partition before flashing 386.3! First, because first boot will convert existing rules into VPN Director rules, as well as migrating the custom configuration entries. If you go back, you will need to either re-enter your rules and custom VPN configs, or restore a backup of your settings. Also, in case something goes wrong during the first boot import process, which may require a factory default reset (it happened to me during development, and while I fixed the bug that caused this, there's always a chance that there is another bug still in there - that's what testing is for).
Test builds are available in the VPN Director folder, at https://www.asuswrt-merlin.net/test-builds/
Things to test:
- Are existing VPN rules properly imported in?
- Same with any custom config you may have with either OpenVPN server or client instances, are they still showing up properly in the Custom Settings area?
- Pretty much related to OpenVPN client routing, either set to All or using rules
- Killswitch behaviour, both on unexpected disconnects or on reboots
- Rule management on the VPN Director page
- Is everything properly applied if you change then apply rules?
- Client status report, stopping/starting clients from the VPN Director page
- Each client page will show rules that are related to itself (plus WAN rules since they also apply). Is that list shown correctly?
Thanks everyone!
Last edited: