by lorenzo95 · 3y ago · 0 comments
So for the cronjob part, that only applies to devices assigned to guests, as they can be used without creating an account on wirehub.
- Create your invite, Guest Role.
- Assign the Device to that Guest.
- Add an Interface on that Device.
- Preview the network as that Guest (click the eye icon next to their username). Open the URL in a new private window, because you need to:
- Accept the Invite.
- As that Guest, you'll just see the device(s) assigned to you. Click on the config button for any device and right click, copy the Download URL. That should contain the invite_code as well, which is basically the authorization token for that Guest.
Now, on your device, just curl the URL, like so:
``` curl 'https://wirehub.org/wirehub/n/hub-network/device/1/download?...' ```
`curl -s -o ./wg0.conf 'https://wirehub.org/wirehub/n/hub-network/device/1/download?...'`
This pulls the config and stores it in `wg0.conf`. The [Interface] section though is invalid (as there's no private key). So you'd have to either generate the keys on the server or somehow get them there. From then on it's just standard wg-quick and wg to create the interface and load your keys.
After the cron job, you'd want to do something like `wg syncconf wg0 <(wg-quick strip wg0)` so that wireguard picks up any changes from the pulled config.