diff --git a/plinth/modules/wireguard/forms.py b/plinth/modules/wireguard/forms.py index 3f03abb42..e81c954c1 100644 --- a/plinth/modules/wireguard/forms.py +++ b/plinth/modules/wireguard/forms.py @@ -32,32 +32,37 @@ class AddClientForm(forms.Form): class AddServerForm(forms.Form): """Form to add server.""" peer_endpoint = forms.CharField( - label=_('Endpoint'), strip=True, - help_text=_('Server endpoint with the form "ip:port".')) + label=_('Endpoint of the server'), strip=True, + help_text=_('Domain name and port in the form "ip:port". Example: ' + 'demo.wireguard.com:12912 .')) peer_public_key = forms.CharField( - label=_('Public key of the server'), strip=True, - help_text=_('Public key of the server.')) + label=_('Public key of the server'), strip=True, help_text=_( + 'Provided by the server operator, a long string of characters.')) ip_address = forms.CharField( label=_('Client IP address provided by server'), strip=True, - help_text=_('IP address assigned to the client on the VPN after ' - 'connecting to the endpoint.')) + help_text=_('IP address assigned to this machine on the VPN after ' + 'connecting to the endpoint. This value is usually ' + 'provided by the server operator. Example: 192.168.0.10.')) private_key = forms.CharField( - label=_('Private key of the client'), strip=True, - help_text=_('Optional. A new key is generated if left blank.'), - required=False) + label=_('Private key of this machine'), strip=True, help_text=_( + 'Optional. New public/private keys are generated if left blank. ' + 'Public key can then be provided to the server. This is the ' + 'recommended way. However, some server operators insist on ' + 'providing this.'), required=False) preshared_key = forms.CharField( - label=_('Pre-shared key'), strip=True, required=False, - help_text=_('Optional. A shared secret key provided by the server to ' - 'add an additional layer of encryption.')) + label=_('Pre-shared key'), strip=True, required=False, help_text=_( + 'Optional. A shared secret key provided by the server to add an ' + 'additional layer of security. Fill in only if provided.')) default_route = forms.BooleanField( label=_('Use this connection to send all outgoing traffic'), - required=False, - help_text=_('Use this connection to send all outgoing traffic.')) + required=False, help_text=_( + 'Typically checked for a VPN service though which all traffic ' + 'is sent.')) def get_settings(self): """Return NM settings dict from cleaned data.""" diff --git a/plinth/modules/wireguard/templates/wireguard.html b/plinth/modules/wireguard/templates/wireguard.html index 8a85d2030..c684a6101 100644 --- a/plinth/modules/wireguard/templates/wireguard.html +++ b/plinth/modules/wireguard/templates/wireguard.html @@ -22,9 +22,9 @@ {% load i18n %} {% block configuration %} -

{% trans "Server" %}

+

{% trans "As a Server" %}

-

{% trans "Peers allowed to connect to this server" %}

+

{% trans "Peers allowed to connect to this server:" %}

@@ -69,11 +69,15 @@ role="button" class="btn btn-default" href="{% url 'wireguard:add-client' %}"> - {% trans "Add Client" %} + {% trans "Add Allowed Client" %} -

{% trans "Client" %}

-

{% trans "Peer servers that FreedomBox will connect to" %}

+

{% trans "As a Client" %}

+

+ {% blocktrans trimmed %} + Servers that {{ box_name }} will connect to: + {% endblocktrans %} +

@@ -112,7 +116,7 @@ role="button" class="btn btn-default" href="{% url 'wireguard:add-server' %}"> - {% trans "Add Server" %} + {% trans "Add Connection to Server" %} {{ block.super }} diff --git a/plinth/modules/wireguard/templates/wireguard_add_server.html b/plinth/modules/wireguard/templates/wireguard_add_server.html index dc508b99c..39df9f286 100644 --- a/plinth/modules/wireguard/templates/wireguard_add_server.html +++ b/plinth/modules/wireguard/templates/wireguard_add_server.html @@ -31,7 +31,7 @@ {{ form|bootstrap }} + value="{% trans "Add Connection" %}"/> {% endblock %} diff --git a/plinth/modules/wireguard/templates/wireguard_delete_client.html b/plinth/modules/wireguard/templates/wireguard_delete_client.html index b69efd23b..b50c5a8fa 100644 --- a/plinth/modules/wireguard/templates/wireguard_delete_client.html +++ b/plinth/modules/wireguard/templates/wireguard_delete_client.html @@ -36,7 +36,7 @@ {% csrf_token %} + value="{% trans "Delete" %}"/> {% endblock %} diff --git a/plinth/modules/wireguard/templates/wireguard_delete_server.html b/plinth/modules/wireguard/templates/wireguard_delete_server.html index b36cdf205..635a395cc 100644 --- a/plinth/modules/wireguard/templates/wireguard_delete_server.html +++ b/plinth/modules/wireguard/templates/wireguard_delete_server.html @@ -45,7 +45,7 @@ {% csrf_token %} + value="{% trans "Delete" %}"/> {% endblock %} diff --git a/plinth/modules/wireguard/templates/wireguard_edit_server.html b/plinth/modules/wireguard/templates/wireguard_edit_server.html index b2f1a6e6c..42722b4e8 100644 --- a/plinth/modules/wireguard/templates/wireguard_edit_server.html +++ b/plinth/modules/wireguard/templates/wireguard_edit_server.html @@ -31,7 +31,7 @@ {{ form|bootstrap }} + value="{% trans "Update Connection" %}"/> {% endblock %} diff --git a/plinth/modules/wireguard/templates/wireguard_show_client.html b/plinth/modules/wireguard/templates/wireguard_show_client.html index 51fc9edd7..aafd39138 100644 --- a/plinth/modules/wireguard/templates/wireguard_show_client.html +++ b/plinth/modules/wireguard/templates/wireguard_show_client.html @@ -22,7 +22,13 @@ {% block content %} -

{% trans "Connection Information" %}

+

{{ title }}

+

+ {% blocktrans trimmed %} + {{ box_name }} will allow this client to connect to it. Ensure that the + client is configured with the following information. + {% endblocktrans %} +

@@ -30,7 +36,7 @@ - + @@ -46,7 +52,7 @@ - + @@ -74,12 +80,12 @@ - {% trans "Edit Client" %} + {% trans "Edit" %} - {% trans "Delete Client" %} + {% trans "Delete" %}

diff --git a/plinth/modules/wireguard/templates/wireguard_show_server.html b/plinth/modules/wireguard/templates/wireguard_show_server.html index 150baab67..4a6764fe4 100644 --- a/plinth/modules/wireguard/templates/wireguard_show_server.html +++ b/plinth/modules/wireguard/templates/wireguard_show_server.html @@ -22,24 +22,44 @@ {% block content %} -

{{ title }}

- -
{{ client.public_key }}
{% trans "IP address to use:" %}{% trans "IP address to use for client:" %} {{ client.allowed_ips|join:", " }}
{% trans "Server's public key:" %}{% trans "Server public key:" %} {{ server.public_key }}
- - {% for peer in server.peers.values %} - {% if forloop.first %} + {% for peer in server.peers.values %} + {% if forloop.first %} +

{{ title }}

+

+ {% blocktrans trimmed %} + {{ box_name }} will attempt to reach a WireGuard server with the + following information. Ensure that the server is configured to allow + {{ box_name }}'s public key and IP address. + {% endblocktrans %} +

+
+ - + - + + + + + + + + + + +
{% trans "Endpoint:" %}{% trans "Server endpoint:" %} {{ peer.endpoint }}
{% trans "Public Key:" %}{% trans "Server public key:" %} {{ peer.public_key }}
{% trans "Pre-shared key:" %} {{ peer.preshared_key }}
{% trans "Public key of this machine:" %}{{ server.public_key }}
{% trans "IP address of this machine:" %}{{ server.ip_address }}
+ +

{% trans "Status" %}

+ + @@ -52,21 +72,21 @@ - {% endif %} - {% endfor %} - -
{% trans "Data transmitted:" %} {{ peer.status.transfer_tx|filesizeformat }}{% trans "Latest handshake:" %} {{ peer.status.latest_handshake|default:'' }}
+ + + {% endif %} + {% endfor %}

- {% trans "Edit Server" %} + {% trans "Edit" %} - {% trans "Delete Server" %} + {% trans "Delete" %}

diff --git a/plinth/modules/wireguard/views.py b/plinth/modules/wireguard/views.py index 1558646a0..519bcab11 100644 --- a/plinth/modules/wireguard/views.py +++ b/plinth/modules/wireguard/views.py @@ -66,7 +66,7 @@ class AddClientView(SuccessMessageMixin, FormView): def get_context_data(self, **kwargs): """Return additional context for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Add Client') + context['title'] = _('Add Allowed Client') return context def form_valid(self, form): @@ -89,7 +89,7 @@ class ShowClientView(SuccessMessageMixin, TemplateView): def get_context_data(self, **kwargs): """Return additional context data for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Show Client') + context['title'] = _('Allowed Client') public_key = urllib.parse.unquote(self.kwargs['public_key']) server_info = utils.get_info()['my_server'] @@ -149,7 +149,7 @@ class DeleteClientView(SuccessMessageMixin, TemplateView): def get_context_data(self, **kwargs): """Return additional context data for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Delete Client') + context['title'] = _('Delete Allowed Client') context['public_key'] = urllib.parse.unquote(self.kwargs['public_key']) return context @@ -175,7 +175,7 @@ class AddServerView(SuccessMessageMixin, FormView): def get_context_data(self, **kwargs): """Return additional context for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Add Server') + context['title'] = _('Add Connection to Server') return context def form_valid(self, form): @@ -191,7 +191,7 @@ class ShowServerView(SuccessMessageMixin, TemplateView): def get_context_data(self, **kwargs): """Return additional context data for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Server Information') + context['title'] = _('Connection to Server') interface = self.kwargs['interface'] info = utils.get_info() @@ -214,7 +214,7 @@ class EditServerView(SuccessMessageMixin, FormView): def get_context_data(self, **kwargs): """Return additional context for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Modify Server') + context['title'] = _('Modify Connection to Server') return context def get_initial(self): @@ -255,7 +255,7 @@ class DeleteServerView(SuccessMessageMixin, TemplateView): def get_context_data(self, **kwargs): """Return additional context data for rendering the template.""" context = super().get_context_data(**kwargs) - context['title'] = _('Delete Server') + context['title'] = _('Delete Connection to Server') interface = self.kwargs['interface'] info = utils.get_nm_info()