mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
- Store the names locally in FreedomBox interface as Network Manager does not support adding a name to a client. - Auto-generate names for ones that currently don't have names and when auto-adding a client. - Allow editing the client name on edit page and manual add page. - Show name in: - WireGuard page - Add client page. - Auto-add client page. - Delete client page. - Show client page. - Link to show client page from name instead of public key in WireGuard. - Add Edit/Delete buttons in auto-add client page. - Style delete client page differently. - Forget all client names when app is uninstalled. Tests: - Unit and functional tests work. - When editing a client, name field is shown. Changing the name works. Changing the public key and name also works. - When adding a client manually, name field is shown. Setting a default name works. Setting a non-default name works. - On the WireGuard main page, name of client is shown and has link to show client page. Links works. There is no link on the pubic key. - When adding a client manually, the name is shown at the top of the page along with the name field at the bottom. - When auto-adding a client. Name is shown in the success notice message. Edit and delete buttons are shown and they work. - On delete client page, information is shown as table. Name and public key are shown. - On show client page, name of the client is shown. - When clients are added without the patches and patches are applied, when viewing WireGuard page, all existing clients are given a name automatically. - After app is uninstalled, the freedombox sqlite3 database does not contain the key 'wireguard_client_names' in 'freedombox_kvstore' table. Uninstalling without any clients does not lead to an error. Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
151 lines
4.7 KiB
HTML
151 lines
4.7 KiB
HTML
{% extends "app.html" %}
|
|
{% comment %}
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
{% endcomment %}
|
|
|
|
{% load bootstrap %}
|
|
{% load i18n %}
|
|
{% load extras %}
|
|
|
|
{% block configuration %}
|
|
<h3>{% trans "As a Server" %}</h3>
|
|
|
|
<p>
|
|
{% url 'bind:index' as bind_url %}
|
|
{% blocktrans trimmed %}
|
|
{{ box_name }} acts a VPN server. Devices can connect to it and route
|
|
traffic safely using {{ box_name }}'s internet connection no matter
|
|
where they are. <a href="{{ bind_url }}">Bind</a> app must be installed
|
|
and enabled for this.
|
|
{% endblocktrans %}
|
|
</p>
|
|
|
|
{% if server.public_key %}
|
|
<p>{% trans "Clients allowed to connect to this server:" %}</p>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table" id="server-peers-list">
|
|
<tr>
|
|
<th>{% trans "Name" %}</th>
|
|
<th>{% trans "Public Key" %}</th>
|
|
<th>{% trans "Client IP addresses" %}</th>
|
|
<th>{% trans "Last Connected Time" %}</th>
|
|
</tr>
|
|
{% if server.peers %}
|
|
{% for peer in server.peers.values %}
|
|
{% if peer.public_key %}
|
|
<tr>
|
|
<td>
|
|
<a href="{% url 'wireguard:show-client' peer.public_key|urlencode:'' %}">
|
|
{{ peer.name }}
|
|
</a>
|
|
</td>
|
|
<td>{{ peer.public_key }}</td>
|
|
<td>{{ peer.allowed_ips|join:", " }}</td>
|
|
<td>{{ peer.status.latest_handshake|default:'' }}</td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="3">
|
|
{% blocktrans trimmed %}
|
|
No peers configured to connect to this {{ box_name }} yet.
|
|
{% endblocktrans %}
|
|
</td>
|
|
</tr>
|
|
{% endif %}
|
|
</table>
|
|
</div>
|
|
|
|
<div class="btn-toolbar">
|
|
<form method="post" action="{% url 'wireguard:auto-add-client' %}">
|
|
{% csrf_token %}
|
|
<button type="submit"
|
|
title="{% trans 'Add a client after generating its keys' %}"
|
|
class="btn btn-primary btn-auto-add-client">
|
|
{% icon 'plus' %}
|
|
{% trans "Add Client" %}
|
|
</button>
|
|
</form>
|
|
<a title="{% trans 'Add a client with an existing key' %}"
|
|
role="button" class="btn btn-default btn-add-client"
|
|
href="{% url 'wireguard:add-client' %}">
|
|
{% icon 'plus' %}
|
|
{% trans "Add Client with an Existing Key" %}
|
|
</a>
|
|
</div>
|
|
{% else %}
|
|
<div>
|
|
<p class="alert alert-info">{% trans "WireGuard server not started yet." %}</p>
|
|
<form method="post" action="{% url 'wireguard:enable-server' %}">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-primary btn-start-server"
|
|
title="{% trans 'Start WireGuard Server' %}">
|
|
{% icon 'rocket' %}
|
|
{% trans "Start WireGuard Server" %}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<h3>{% trans "As a Client" %}</h3>
|
|
<p>
|
|
{% blocktrans trimmed %}
|
|
{{ box_name }} can connect to a VPN server and route it's traffic
|
|
through the internet connection of a VPN provider.
|
|
{% endblocktrans %}
|
|
<p>
|
|
{% blocktrans trimmed %}
|
|
Servers that {{ box_name }} will connect to:
|
|
{% endblocktrans %}
|
|
</p>
|
|
<div class="table-responsive">
|
|
<table class="table" id="client-peers-list">
|
|
<tr>
|
|
<th>{% trans "Endpoint" %}</th>
|
|
<th>{% trans "Public Key" %}</th>
|
|
<th>{% trans "Last Connected Time" %}</th>
|
|
</tr>
|
|
{% if client_peers %}
|
|
{% for interface, server in client_peers.items %}
|
|
{% for peer in server.peers.values %}
|
|
{% if forloop.first %}
|
|
<tr>
|
|
<td class="peer-endpoint">{{ peer.endpoint }}</td>
|
|
<td class="peer-public-key"
|
|
data-public-key="{{ peer.public_key }}">
|
|
<a href="{% url 'wireguard:show-server' interface %}">
|
|
{{ peer.public_key }}
|
|
</a>
|
|
</td>
|
|
<td>{{ peer.status.latest_handshake|default:'' }}</td>
|
|
</tr>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="4">
|
|
{% blocktrans trimmed %}
|
|
No connections to remote servers are configured yet.
|
|
{% endblocktrans %}
|
|
</td>
|
|
</tr>
|
|
{% endif %}
|
|
</table>
|
|
</div>
|
|
|
|
<div class="btn-toolbar">
|
|
<a title="{% trans 'Add a new server' %}"
|
|
role="button" class="btn btn-default btn-add-server"
|
|
href="{% url 'wireguard:add-server' %}">
|
|
{% icon 'plus' %}
|
|
{% trans "Add Connection to Server" %}
|
|
</a>
|
|
</div>
|
|
|
|
{{ block.super }}
|
|
|
|
{% endblock %}
|