If you can't pre-share a key like that, you can run a variety of PQ key exchanges (which I suppose now has come to implicitly stand in for, "primitives that are not yet broken by AI"), or multiple of such key exchanges combined, through an established WireGuard tunnel, and then pop the result into the pre-shared key slot.
I wonder how feasible it would be to rig together a shell script to do that using nothing but openssl(1) (because you probably already have it installed).
edit: It seems like openssl-pkeyutl has everything needed for this - so, if you just want to temporarily update the current connection, I think something like the following should work (untested)?
server$ openssl genpkey -algorithm ML-KEM-768 -out server_priv.pem
server$ openssl pkey -in server_priv.pem -pubout -out server_pub.pem
# copy server_pub.pem to client...
client$ openssl pkeyutl -encap -inkey server_pub.pem -pubin -out ciphertext.bin -secret psk.bin
# copy ciphertext.bin to server...
server$ openssl pkeyutl -decap -inkey server_priv.pem -in ciphertext.bin -secret psk.bin
# on both ends
$ wg set $iface peer $peer preshared-key psk.bin
On the server-side you'd probably also want a timeout that restores the previous psk if you don't reconnect in time. But I think that's basically it? You could then probably use wg-quick save to persist the changes.
Good to know about PresharedKey! I just set it up right now since I only use WireGuard on three devices (homelab, laptop, phone). It was very easy to do.
dzwdz | 2 hours ago
I wonder how feasible it would be to rig together a shell script to do that using nothing but openssl(1) (because you probably already have it installed).
edit: It seems like openssl-pkeyutl has everything needed for this - so, if you just want to temporarily update the current connection, I think something like the following should work (untested)?
On the server-side you'd probably also want a timeout that restores the previous psk if you don't reconnect in time. But I think that's basically it? You could then probably use
wg-quick saveto persist the changes.mk12 | 38 minutes ago
Good to know about PresharedKey! I just set it up right now since I only use WireGuard on three devices (homelab, laptop, phone). It was very easy to do.