wireguard: Update descriptions for client vs. server clarity

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-11-04 09:56:13 -08:00 committed by James Valleroy
parent 6e1b0a3642
commit 2b9d278a95
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
9 changed files with 85 additions and 50 deletions

View File

@ -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."""

View File

@ -22,9 +22,9 @@
{% load i18n %}
{% block configuration %}
<h3>{% trans "Server" %}</h3>
<h3>{% trans "As a Server" %}</h3>
<p>{% trans "Peers allowed to connect to this server" %}</p>
<p>{% trans "Peers allowed to connect to this server:" %}</p>
<table class="table table-bordered table-condensed table-striped"
id="server-peers-list">
@ -69,11 +69,15 @@
role="button" class="btn btn-default"
href="{% url 'wireguard:add-client' %}">
<span class="fa fa-plus" aria-hidden="true"></span>
{% trans "Add Client" %}
{% trans "Add Allowed Client" %}
</a>
<h3>{% trans "Client" %}</h3>
<p>{% trans "Peer servers that FreedomBox will connect to" %}</p>
<h3>{% trans "As a Client" %}</h3>
<p>
{% blocktrans trimmed %}
Servers that {{ box_name }} will connect to:
{% endblocktrans %}
</p>
<table class="table table-bordered table-condensed table-striped"
id="client-peers-list">
<tr>
@ -112,7 +116,7 @@
role="button" class="btn btn-default"
href="{% url 'wireguard:add-server' %}">
<span class="fa fa-plus" aria-hidden="true"></span>
{% trans "Add Server" %}
{% trans "Add Connection to Server" %}
</a>
{{ block.super }}

View File

@ -31,7 +31,7 @@
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans "Add Server" %}"/>
value="{% trans "Add Connection" %}"/>
</form>
{% endblock %}

View File

@ -36,7 +36,7 @@
{% csrf_token %}
<input type="submit" class="btn btn-danger"
value="{% trans "Delete Client" %}"/>
value="{% trans "Delete" %}"/>
</form>
{% endblock %}

View File

@ -45,7 +45,7 @@
{% csrf_token %}
<input type="submit" class="btn btn-danger"
value="{% trans "Delete Server" %}"/>
value="{% trans "Delete" %}"/>
</form>
{% endblock %}

View File

@ -31,7 +31,7 @@
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans "Update Server" %}"/>
value="{% trans "Update Connection" %}"/>
</form>
{% endblock %}

View File

@ -22,7 +22,13 @@
{% block content %}
<h3>{% trans "Connection Information" %}</h3>
<h3>{{ title }}</h3>
<p>
{% blocktrans trimmed %}
{{ box_name }} will allow this client to connect to it. Ensure that the
client is configured with the following information.
{% endblocktrans %}
</p>
<table class="table table-bordered table-condensed table-striped">
<tbody>
<tr>
@ -30,7 +36,7 @@
<td>{{ client.public_key }}</td>
</tr>
<tr>
<th>{% trans "IP address to use:" %}</th>
<th>{% trans "IP address to use for client:" %}</th>
<td>{{ client.allowed_ips|join:", " }}</td>
</tr>
<tr>
@ -46,7 +52,7 @@
</td>
</tr>
<tr>
<th>{% trans "Server's public key:" %}</th>
<th>{% trans "Server public key:" %}</th>
<td>{{ server.public_key }}</td>
</tr>
</tbody>
@ -74,12 +80,12 @@
<a class="btn btn-default"
href="{% url 'wireguard:edit-client' client.public_key|urlencode:'' %}">
<span class="fa fa-pencil-square-o" aria-hidden="true"></span>
{% trans "Edit Client" %}
{% trans "Edit" %}
</a>
<a class="btn btn-default"
href="{% url 'wireguard:delete-client' client.public_key|urlencode:'' %}">
<span class="fa fa-trash-o" aria-hidden="true"></span>
{% trans "Delete Client" %}
{% trans "Delete" %}
</a>
</p>

View File

@ -22,24 +22,44 @@
{% block content %}
<h3>{{ title }}</h3>
<table class="table table-bordered table-condensed table-striped">
<tbody>
{% for peer in server.peers.values %}
{% if forloop.first %}
{% for peer in server.peers.values %}
{% if forloop.first %}
<h3>{{ title }}</h3>
<p>
{% 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 %}
</p>
<table class="table table-bordered table-condensed table-striped">
<tbody>
<tr>
<th>{% trans "Endpoint:" %}</th>
<th>{% trans "Server endpoint:" %}</th>
<td>{{ peer.endpoint }}</td>
</tr>
<tr>
<th>{% trans "Public Key:" %}</th>
<th>{% trans "Server public key:" %}</th>
<td>{{ peer.public_key }}</td>
</tr>
<tr>
<th>{% trans "Pre-shared key:" %}</th>
<td>{{ peer.preshared_key }}</td>
</tr>
<tr>
<th>{% trans "Public key of this machine:" %}</th>
<td>{{ server.public_key }}</td>
</tr>
<tr>
<th>{% trans "IP address of this machine:" %}</th>
<td>{{ server.ip_address }}</td>
</tr>
</tbody>
</table>
<h3>{% trans "Status" %}</h3>
<table class="table table-bordered table-condensed table-striped">
<tbody>
<tr>
<th>{% trans "Data transmitted:" %}</th>
<td>{{ peer.status.transfer_tx|filesizeformat }}</td>
@ -52,21 +72,21 @@
<th>{% trans "Latest handshake:" %}</th>
<td>{{ peer.status.latest_handshake|default:'' }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</tbody>
</table>
{% endif %}
{% endfor %}
<p>
<a class="btn btn-default"
href="{% url 'wireguard:edit-server' interface %}">
<span class="fa fa-pencil-square-o" aria-hidden="true"></span>
{% trans "Edit Server" %}
{% trans "Edit" %}
</a>
<a class="btn btn-default"
href="{% url 'wireguard:delete-server' interface %}">
<span class="fa fa-trash-o" aria-hidden="true"></span>
{% trans "Delete Server" %}
{% trans "Delete" %}
</a>
</p>

View File

@ -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()