Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Added wireguard support. #28

Open
dreirund opened this issue Apr 26, 2022 · 0 comments
Open

[Enhancement] Added wireguard support. #28

dreirund opened this issue Apr 26, 2022 · 0 comments

Comments

@dreirund
Copy link

I have added a wireguard-connection:

/usr/lib/network/connections/wireguard:

#!/bin/bash

. /usr/lib/network/network
: ${WIREGUARD:=wg-quick}

[[ -z "$WG_CONFIG" ]] && WG_CONFIG='/etc/wireguard/default.conf'

wireguard_up() {
  load_profile "$1"

  "${WIREGUARD}" up "${WG_CONFIG}"

  if [[ $? -ne 0 ]]; then
    report_fail "wireguard connection failed."
    exit 1
  fi
}

wireguard_down() {
  load_profile "$1"

  "${WIREGUARD}" down "${WG_CONFIG}"

  if [[ $? -ne 0 ]]; then
    report_fail "wireguard disconnection failed."
  fi
}

wireguard_$1 "$2"
exit $?

/etc/network.d/examples/wireguard:

CONNECTION="wireguard"
# WIREGUARD="wg-quick" # Optional; specifies the `wg-quick` compatible executable to use. If not specified, defaults to `wg-quick`.
INTERFACE="wg-ai"
WG_CONFIG="/etc/wireguard/wg-ai.conf" # Specify the wireguard configuration to use.

Depends on wireguard-tools and, of course, wireguard support in the kernel.

Fell free to incorporate. I don't know how to do pull requests, so I post it here that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant