A WireGuard VPN provides a fast, secure tunnel between endpoints. It uses public/private key pairs to encrypt the data.
If you have several clients, you have to enter their public keys into your server. Keeping track of those keys gets to be a hassle, since ordinarily, the keys are essentially random numbers.
I found a great project to help this problem: WireGuard Vanity Address. It continually generates WireGuard private/public key pairs, printing keys that contain a desired string in the first 10 characters. For example, I generated this public key for my MacBook Pro (MBP):
MBP/DzPRZ05vNZ0XS3P9tlokZPrLy/1lb1Zsm3du4QA= Note the
MBP/ at the start – it makes it easy to know that this is my Mac’s key.
To do it, I ran the wireguard-vanity-address program. Here is sample output:
$ ./wireguard-vanity-address MBP/ searching for 'mbp/' in pubkey[0..10], one of every 299593 keys should match one trial takes 28.7 us, CPU cores available: 2 est yield: 4.3 seconds per key, 232.30e-3 keys/s hit Ctrl-C to stop private qMKPNrCMId59XTn5vgDICUh/QzIfhqZdrZ+XQBIJj2w= public zmbP/YEpC8Zl6MacYhcY1lq126tL2UudFjmrwbl2/18= private HHtPY8IwGBxQ5OTtJY6GcuFpImXtDp9d187zvI0axFo= public qhIiSMbp/extT5irPy4EJfLRPR9jTzQZHlM15Fo/P2E= private BEnEu1lVdcRI997nj2uPNGsyCZNPhBTCNfgJuYPPJHA= public hZzmBP/8EthWPOFp5wroEGPeJTHGxZ5KENnMiZvniGY= private 8HRj+YZfSBnYZn38MPE09W2g03JvRJoGbjlDkHQ0Wnk= public mBP/q2dOd+m457PyKTIvI7MDTuXLCneG6MM0ir9rwRc= ... private dFE8xsDDWNNNY1OjOIlxQiNVbp7Z6tZhXsaOo/5gPH0= public MBP/DzPRZ05vNZ0XS3P9tlokZPrLy/1lb1Zsm3du4QA= ^C # This last line contains a public key starting with "MBP/"
For more details, read the github page, and also the issue where the author addresses security concerns about decreasing the size of the key space.
Update: I created a Dockerfile to make it even easier to run
wireguard-vanity-address. Check out my personal github repo for details.