Hi Oskarsk,
Besides thinking about adding the functionality/option of “amnezia”, to summarize… , for any reader, this thread was designed to:
a. recognize the three main types of wireguard connections
b. attempt to make configuration as smooth and easy as possible
c. to automate sharing of config to clients etc as easy as possible.
When attempting to describe requirements, it became clear that the three wireguard setups involve:
- when both sides generate private and public Keys ( MT router and other devices - manual )
- when a third party server provides the private key for both ends. ( MT router is a client device )
- When MT generates both private and public keys for devices (MT router is server device - automated)
One should be able to identify any wireguard instance in one of the three selections. Note this is not meant to replace BTH, which is a separate USE case, for when ones Router has no public IP address and one still wants to be able to remotely connect to local subnets and/or config ones own router.
However, using the functionality uncovered in BTH (added by MT RoS), we should be able to create QR codes or config files with correct information for especially CASE 3 above!
Not a gui presentation expert by any means. My initial attempt, according to MT feedback was to complex and thus the latest rendition was aimed at mostly a one page config setup displayed to the admin.
The key to keeping wireguard config simple is to maximize logic. Clearly the first step in the wireguard process is for the admin to create a Wireguard Interface. It is at this step that, besides the obvious name, the admin identifies to the MT, whether the Private key is being auto generated by the MT router ( covers case1 and case3) OR is a manual entry from a third party device/provider ( case2 ).
Other Interface Boxes:
- we optionally allow the wireguard Ip address and subnet to be entered here vice having to move screens and go to /IP address.
- we default Responder only to SELECTED, when auto generate is selected ( MT likely server ) and is automatically applied to all client peers ( unselectable at peers).
- we allow selection of src-port rotation ( when MT is client device to combat known issues - resets the handshake )
The logic continues when selecting a new peer.
The first step is to identify the INTERFACE ( by pull-down)
The admin then selects the available presented options.
- If automated Key was selected then Manual and Automated Peers are available.
- If manual Key entry was selected the Third Party Peers selection is available.
The most interesting and NEW work, is the automated peers. Borrowing from BTH, we want to setup an easy method for the admin to provide unique private-public keys for each device. They all of course will get the common public key generated by the MT router for the single wg interface.
Once the requisite information is filled out for the first peer, then, for subsequent peers (endpoint port, address and keep alive are default copied from first peer)
One should not that the MT router will READ the IP address for the interface and will provide the next sequential IP address to send to the next client device peer by default.
Borrowing some more from BTH, we use the Routers capacity to generate and temporarily store QR code and Config Files for sending to clients, and thus have a robust, flexible EXPORT function.
++++++++++++++++++++++
Final thoughts.
I have not covered importing but at least we should be able to import.
a. any standard config file/QR code for when the MT router is a client for handshake on a wireguard network
b. a config file/qr code generated by another MT router ( recipient of automated send )
Please feel free to point out any issue, missing items or potential improvements to the above.
Lastly, I am also asking MT staff to implement available linux code functionality to address our ability to use wireguard on Secondary WAN connections. This is handled by property (fwmark) that is found within normal linux wireguard structure. This property allows all packets emitted by wg to be marked on creation. This would allow us to apply appropriate config changes to ensure incoming WG on wan2 would go back out wan2. We stumble upon this during RoS as most people do not know that the wireguard interface does not apply/decide source IP like other protocols.