[PATCH] wg-quick linux: Add strip-and-eval cmd to extract keys from PostUp

Robin Schneider ypid at riseup.net
Sat Oct 10 17:57:48 CEST 2020


Hi Jason,

On 2020-10-09 14:20, Jason A. Donenfeld wrote:
> This seems like a weird inconsistent hack. Strip should return
> something that is acted on by something else, and not also do things.

I know. Thats why I made this clear by making it a separate subcommand so that users can choose if they want this hack or not.

> 
> But I have another suggestion on how to achieve what you want:
> 
> wg syncconf wg0 <(printf '[Interface]\nPrivateKey=%s\n' "$(wg show wg0
> private-key)"; wg-quick strip wg0)
> 

At first I considered/implemented such a workaround on the systemd level. It is good to know that I would not have to care about merging two INI files as `wg` can handle two `Interface` sections and merge them together itself as it seems.

The proposed workaround has two issues:

1. It does not allow to replace the PrivateKey or PresharedKey using the `syncconf` now from the config file which is what I want to have.
2. It only outputs the PrivateKey and not the PresharedKey for each peer. Sure, this could be done with a for loop.

-- 
Live long and prosper
Robin `ypid` Schneider -- https://me.ypid.de/


More information about the WireGuard mailing list