wg-quick: Separate files for interface and peer definitions?

Samuel Holland samuel at sholland.org
Thu Dec 27 20:06:53 CET 2018

On 12/27/18 10:19, Rene 'Renne' Bartsch, B.Sc. Informatics wrote:
> we want to distribute the same file with peer definitions to all Wireguard 
> peers.
> Is there any way in wg-quick to use one configuration file for the interface 
> definition and another file for the definition of peers?

In a way, yes. You can call `wg addconf` from a wg-quick PostUp hook to include
another configuration file containing only peers. However, the recommended way
of doing this if you are using a configuration management system
(puppet/ansible/salt/etc.) is to use a template that will concatenate the
interface configuration and peer definitions into one file.

Note that WireGuard will ignore a peer whose public key matches the interface's
private key. So you can distribute a single list of peers everywhere. Only the
[Interface] section needs to be customized per machine.

Hope that helps,

More information about the WireGuard mailing list