~garritfra/wireguard-tools

a36c101a77c9e8126ca520e95a5b0c938b3c7897 — Garrit Franke 4 years ago 7a321ce + f25ddde master v1.0.20200827.0
Merge branch 'master' into v1.0.20200827.0
M src/man/wg-quick.8 => src/man/wg-quick.8 +5 -3
@@ 10,6 10,8 @@ wg-quick - set up a WireGuard interface simply
|
.I down
|
.I restart
|
.I save
|
.I strip


@@ 24,11 26,11 @@ wg-quick - set up a WireGuard interface simply
This is an extremely simple script for easily bringing up a WireGuard interface,
suitable for a few common use cases.

Use \fIup\fP to add and set up an interface, and use \fIdown\fP to tear down and remove
an interface. Running \fIup\fP adds a WireGuard interface, brings up the interface with the
Use \fIup\fP to add and set up an interface, use \fIdown\fP to tear down and remove
an interface, and use \fIrestart\fP to restart an interface. Running \fIup\fP adds a WireGuard interface, brings up the interface with the
supplied IP addresses, sets up mtu and routes, and optionally runs pre/post up scripts. Running \fIdown\fP
optionally saves the current configuration, removes the WireGuard interface, and optionally
runs pre/post down scripts. Running \fIsave\fP saves the configuration of an existing
runs pre/post down scripts. \fIrestart\fP simply combines the \fIup\fP and \fIdown\fP command. Running \fIsave\fP saves the configuration of an existing
interface without bringing the interface down. Use \fIstrip\fP to output a configuration file
with all
.BR wg-quick (8)-specific

M src/wg-quick/darwin.bash => src/wg-quick/darwin.bash +13 -1
@@ 418,7 418,7 @@ execute_hooks() {

cmd_usage() {
	cat >&2 <<-_EOF
	Usage: $PROGRAM [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
	Usage: $PROGRAM [ up | down | restart | save | strip ] [ CONFIG_FILE | INTERFACE ]

	  CONFIG_FILE is a configuration file, whose filename is the interface name
	  followed by \`.conf'. Otherwise, INTERFACE is an interface name, with


@@ 478,6 478,14 @@ cmd_down() {
	execute_hooks "${POST_DOWN[@]}"
}

cmd_restart() {
	if ! get_real_interface || [[ " $(wg show interfaces) " != *" $REAL_INTERFACE "* ]]; then
		die "\`$INTERFACE' is not a WireGuard interface"
	fi
	cmd_down
	cmd_up
}

cmd_save() {
	if ! get_real_interface || [[ " $(wg show interfaces) " != *" $REAL_INTERFACE "* ]]; then
		die "\`$INTERFACE' is not a WireGuard interface"


@@ 502,6 510,10 @@ elif [[ $# -eq 2 && $1 == down ]]; then
	auto_su
	parse_options "$2"
	cmd_down
elif [[ $# -eq 2 && $1 == restart ]]; then
	auto_su
	parse_options "$2"
	cmd_restart
elif [[ $# -eq 2 && $1 == save ]]; then
	auto_su
	parse_options "$2"

M src/wg-quick/freebsd.bash => src/wg-quick/freebsd.bash +11 -1
@@ 387,7 387,7 @@ execute_hooks() {

cmd_usage() {
	cat >&2 <<-_EOF
	Usage: $PROGRAM [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
	Usage: $PROGRAM [ up | down | restart | save | strip ] [ CONFIG_FILE | INTERFACE ]

	  CONFIG_FILE is a configuration file, whose filename is the interface name
	  followed by \`.conf'. Otherwise, INTERFACE is an interface name, with


@@ 445,6 445,12 @@ cmd_down() {
	execute_hooks "${POST_DOWN[@]}"
}

cmd_restart() {
	[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
	cmd_down
	cmd_up
}

cmd_save() {
	[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
	save_config


@@ 469,6 475,10 @@ elif [[ $# -eq 2 && $1 == down ]]; then
	auto_su
	parse_options "$2"
	cmd_down
elif [[ $# -eq 2 && $1 == restart ]]; then
	auto_su
	parse_options "$2"
	cmd_restart
elif [[ $# -eq 2 && $1 == save ]]; then
	auto_su
	parse_options "$2"

M src/wg-quick/linux.bash => src/wg-quick/linux.bash +11 -1
@@ 298,7 298,7 @@ execute_hooks() {

cmd_usage() {
	cat >&2 <<-_EOF
	Usage: $PROGRAM [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
	Usage: $PROGRAM [ up | down | restart | save | strip ] [ CONFIG_FILE | INTERFACE ]

	  CONFIG_FILE is a configuration file, whose filename is the interface name
	  followed by \`.conf'. Otherwise, INTERFACE is an interface name, with


@@ 352,6 352,12 @@ cmd_down() {
	execute_hooks "${POST_DOWN[@]}"
}

cmd_restart() {
	[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
	cmd_down
	cmd_up
}

cmd_save() {
	[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
	save_config


@@ 373,6 379,10 @@ elif [[ $# -eq 2 && $1 == down ]]; then
	auto_su
	parse_options "$2"
	cmd_down
elif [[ $# -eq 2 && $1 == restart ]]; then
	auto_su
	parse_options "$2"
	cmd_restart
elif [[ $# -eq 2 && $1 == save ]]; then
	auto_su
	parse_options "$2"

M src/wg-quick/openbsd.bash => src/wg-quick/openbsd.bash +13 -1
@@ 390,7 390,7 @@ execute_hooks() {

cmd_usage() {
	cat >&2 <<-_EOF
	Usage: $PROGRAM [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
	Usage: $PROGRAM [ up | down | restart | save | strip ] [ CONFIG_FILE | INTERFACE ]

	  CONFIG_FILE is a configuration file, whose filename is the interface name
	  followed by \`.conf'. Otherwise, INTERFACE is an interface name, with


@@ 448,6 448,14 @@ cmd_down() {
	execute_hooks "${POST_DOWN[@]}"
}

cmd_restart() {
	if ! get_real_interface || [[ " $(wg show interfaces) " != *" $REAL_INTERFACE "* ]]; then
		die "\`$INTERFACE' is not a WireGuard interface"
	fi
	cmd_down
	cmd_up
}

cmd_save() {
	if ! get_real_interface || [[ " $(wg show interfaces) " != *" $REAL_INTERFACE "* ]]; then
		die "\`$INTERFACE' is not a WireGuard interface"


@@ 471,6 479,10 @@ elif [[ $# -eq 2 && $1 == down ]]; then
	auto_su
	parse_options "$2"
	cmd_down
elif [[ $# -eq 2 && $1 == restart ]]; then
	auto_su
	parse_options "$2"
	cmd_restart
elif [[ $# -eq 2 && $1 == save ]]; then
	auto_su
	parse_options "$2"