Rosenpass: Difference between revisions
generate keys on the hosts. |
|||
Line 20: | Line 20: | ||
We will first need to generate and then distribute the keypairs. | We will first need to generate and then distribute the keypairs. | ||
Creating the key pairs is simple: | Creating the key pairs is simple, but to do this securely, it should happen on the respective hosts. | ||
This way it becomes a bit elaborate to distribute the public keys to the other respective peer: | |||
<syntaxHighlight lang="bash"> | <syntaxHighlight lang="bash"> | ||
ssh root@server "rm -rf /var/secrets/{rp,wg} && mkdir -m 755 -p /var/secrets/{rp,wg} && chown systemd-network:systemd-network /var/secrets/wg" | |||
mkdir | ssh root@client "rm -rf /var/secrets/{rp,wg} && mkdir -m 755 -p /var/secrets/{rp,wg} && chown systemd-network:systemd-network /var/secrets/wg" | ||
ssh root@server "cd /var/secrets/rp && rosenpass gen-keys --secret-key pqsk --public-key pqpk" | |||
rosenpass gen-keys --secret-key | ssh root@client "cd /var/secrets/rp && rosenpass gen-keys --secret-key pqsk --public-key pqpk" | ||
rosenpass gen-keys --secret-key | |||
ssh root@server "cd /var/secrets/wg && wg genkey | tee wgsk | wg pubkey > wgpk" | |||
wg genkey | tee | ssh root@client "cd /var/secrets/wg && wg genkey | tee wgsk | wg pubkey > wgpk" | ||
wg genkey | tee | |||
rsync root@server:/var/secrets/rp/pqpk server.pqpk | |||
rsync root@client:/var/secrets/rp/pqpk client.pqpk | |||
rsync --perms --chmod=644 server.pqpk root@client:/var/secrets/rp/server.pqpk | |||
rsync --perms --chmod=644 client.pqpk root@server:/var/secrets/rp/client.pqpk | |||
ssh root@server "echo server wg pubkey is \$(cat /var/secrets/wg/wgpk)" | |||
ssh root@client "echo client wg pubkey is \$(cat /var/secrets/wg/wgpk)" | |||
</syntaxHighlight> | |||
Note down the results of the last two printed lines as these are the public keys that need to be entered in the following NixOS configuration snippets. | |||
You can create as many keypairs as you like for different connections or roles; it is also possible to reuse the same keypair for every connection. | |||
===Server setup=== | ===Server setup=== |