diff --git a/plinth/modules/wireguard/__init__.py b/plinth/modules/wireguard/__init__.py index 88ff30995..9f830e77c 100644 --- a/plinth/modules/wireguard/__init__.py +++ b/plinth/modules/wireguard/__init__.py @@ -104,6 +104,19 @@ def setup(helper, old_version=None): helper.call('post', app.enable) +def get_public_key(): + """Return this box's public key.""" + public_key_path = '/var/lib/freedombox/wireguard/publickey' + try: + with open(public_key_path) as public_key_file: + public_key = public_key_file.read().strip() + + except FileNotFoundError: + public_key = None + + return public_key + + def get_info(): """Return server and clients info.""" output = actions.superuser_run('wireguard', ['get-info']) diff --git a/plinth/modules/wireguard/templates/wireguard.html b/plinth/modules/wireguard/templates/wireguard.html index 48ca39aa5..2cc397113 100644 --- a/plinth/modules/wireguard/templates/wireguard.html +++ b/plinth/modules/wireguard/templates/wireguard.html @@ -25,6 +25,7 @@
{% trans "Peers allowed to connect to this server" %}
+