Sunil Mohan Adapa 9009cdafd6
config, names: Move domain name configuration to names app
Tests:

- Config app description is as expected.
- Config form does not show domain name field anymore.
  - Submitting the form with changes works.
- Names app has correct link for configuring static domain name. Clicking it
  takes to page for setting domain name.
- On startup, static domian name signal is sent properly if set. Otherwise no
  signal is send.
- Change domain name form shows correct value for current domain name.
- Change domain name form sets the value for domain name properly.
  - Page title is correct.
  - Validations works.
  - Add/remove domain name signals are sent properly.
  - Success message as shown expected
  - /etc/hosts is updated as expected.
- Unit tests work.
- Functional tests on ejabberd, letsencrypt, matrix, email, jsxc, openvpn
- After freshly starting the service. Visiting names app shows correct list of
  domains.
- ejabberd:
  - Installs works as expected. Currently set domain_name is setup properly.
    Copy certificate happens on proper domain.
  - Changing the domain sets the domain properly in ejabberd configuration.
  - Ejabberd app page shows link to name services instead of config app.
    Clicking works as expected.
- letsencrypt:
  - When no domains are configured, the link to 'Configure domains' is to the
    names app.
- matrix-synapse:
  - Domain name is properly shown in the status.
- email:
  - Primary domain name is shows properly in the app page.
  - Setting new primary domain works.
  - When installing, domain set as static domain name is prioritized as primary
    domain.
- jsxc:
  - Show the current static domain name in the domain field. BOSH server is
    available.
- openvpn:
  - Show the current static domain in profile is set otherwise show the current
    hostname.
  - If domain name is not set, downloaded OpenVPN profile shows hostname.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2024-09-19 13:43:32 +03:00

118 lines
4.6 KiB
HTML

{% extends "app.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block page_head %}
<link type="text/css" rel="stylesheet"
href="{% static 'letsencrypt/letsencrypt.css' %}"/>
{% endblock %}
{% block configuration %}
<h3>{% trans "Status" %}</h3>
{% if status.domains %}
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{% trans "Domain" %}</th>
<th>{% trans "Certificate Status" %}</th>
<th>{% trans "Website Security" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for domain, domain_status in status.domains.items %}
<tr>
<td>{{ domain }}</td>
<td>
{% if domain_status.certificate_available and domain_status.validity == "valid" %}
<span class="badge badge-success">
{% blocktrans trimmed with expiry_date=domain_status.expiry_date %}
Valid, expires on {{ expiry_date }}
{% endblocktrans %}
</span>
{% elif domain_status.certificate_available and not domain_status.validity == "valid" %}
<span class="badge badge-warning">
{% if "revoked" in domain_status.validity %}
{% blocktrans trimmed %}
Revoked
{% endblocktrans %}
{% elif "expired" in domain_status.validity %}
{% blocktrans trimmed with expiry_date=domain_status.expiry_date %}
Expired on {{ expiry_date }}
{% endblocktrans %}
{% elif "test" in domain_status.validity %}
{% blocktrans trimmed %}
Invalid test certificate
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with reason=domain_status.validity %}
Invalid ({{ reason }})
{% endblocktrans %}
{% endif %}
</span>
{% else %}
<span class="badge badge-warning">
{% trans "No certificate" %}
</span>
{% endif %}
</td>
<td>
{% if domain_status.web_enabled %}
<span class="badge badge-success">{% trans "Enabled" %}</span>
{% else %}
<span class="badge badge-warning">{% trans "Disabled" %}</span>
{% endif %}
</td>
<td class="operations">
{% if domain_status.certificate_available %}
<form class="form" method="post"
action="{% url 'letsencrypt:re-obtain' domain %}">
{% csrf_token %}
<button class="btn btn-sm btn-default" type="submit">
{% trans "Re-obtain" %}</button>
</form>
<form class="form" method="post"
action="{% url 'letsencrypt:delete' domain %}">
{% csrf_token %}
<button class="btn btn-sm btn-default" type="submit">
{% trans "Delete" %}</button>
</form>
{% if "revoked" not in domain_status.validity %}
<form class="form" method="post"
action="{% url 'letsencrypt:revoke' domain %}">
{% csrf_token %}
<button class="btn btn-sm btn-default" type="submit">
{% trans "Revoke" %}</button>
</form>
{% endif %}
{% else %}
<form class="form" method="post"
action="{% url 'letsencrypt:obtain' domain %}">
{% csrf_token %}
<button class="btn btn-sm btn-primary" type="submit">
{% trans "Obtain" %}</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{% url 'names:index' as names_url %}
{% blocktrans trimmed %}
No domains have been configured. <a href="{{ names_url }}">Configure
domains</a> to be able to obtain certificates for them.
{% endblocktrans %}
{% endif %}
{% endblock %}