The example in the man page at some point changed:
- \fBPostUp = wg set %i private-key <(pass WireGuard/private-keys/%i)\fP
+ \fBPreUp = wg set %i private-key <(pass WireGuard/private-keys/%i)\fP
This is actually wrong because PreUp is followed by set_config(), which
calls `wg setconf`, which in turn deletes the private key from the
interface because it is missing from the configuration. Replacing this
with `wg addconf` is safe to do because the interface is newly created.
Suggested-by: Matthias Dressel <code@deadcode.eu>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
static void set_config(const char *iface, const char *config)
{
FILE *config_writer;
- _cleanup_free_ char *cmd = concat("wg setconf ", iface, " /proc/self/fd/0", NULL);
+ _cleanup_free_ char *cmd = concat("wg addconf ", iface, " /proc/self/fd/0", NULL);
int ret;
printf("[#] %s\n", cmd);
}
set_config() {
- cmd wg setconf "$REAL_INTERFACE" <(echo "$WG_CONFIG")
+ cmd wg addconf "$REAL_INTERFACE" <(echo "$WG_CONFIG")
}
save_config() {
}
set_config() {
- echo "$WG_CONFIG" | cmd wg setconf "$INTERFACE" /dev/stdin
+ echo "$WG_CONFIG" | cmd wg addconf "$INTERFACE" /dev/stdin
}
save_config() {
}
set_config() {
- cmd wg setconf "$INTERFACE" <(echo "$WG_CONFIG")
+ cmd wg addconf "$INTERFACE" <(echo "$WG_CONFIG")
}
save_config() {
}
set_config() {
- cmd wg setconf "$REAL_INTERFACE" <(echo "$WG_CONFIG")
+ cmd wg addconf "$REAL_INTERFACE" <(echo "$WG_CONFIG")
}
save_config() {