mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-22 11:59:33 +00:00
monkeysphere: Add key detail view
This commit is contained in:
parent
18db38002b
commit
8c96d381e6
@ -63,7 +63,10 @@
|
||||
<td>{{ domain.name }}</td>
|
||||
<td>
|
||||
{% if domain.key %}
|
||||
{{ domain.key.pgp_fingerprint }}
|
||||
<a href="{% url 'monkeysphere:details' domain.key.pgp_fingerprint %}"
|
||||
title="Show details for key {{ domain.key.pgp_fingerprint }}">
|
||||
{{ domain.key.pgp_fingerprint }}
|
||||
</a>
|
||||
{% else %}
|
||||
{% trans "Not Available" %}
|
||||
{% endif %}
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
{% extends "base.html" %}
|
||||
{% comment %}
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
{% endcomment %}
|
||||
|
||||
{% load bootstrap %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{% trans "Monkeysphere" %}</h2>
|
||||
|
||||
<table class="table table-bordered table-condensed table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{% trans "OpenPGP Fingerprint" %}</td>
|
||||
<td>{{ key.pgp_fingerprint }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "OpenPGP Key ID" %}</td>
|
||||
<td>{{ key.pub }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "OpenPGP User ID" %}</td>
|
||||
<td>{{ key.uid }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Key Generation Date" %}</td>
|
||||
<td>{{ key.date }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "SSH Key Type" %}</td>
|
||||
<td>{{ key.ssh_key_type }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "SSH Key Size" %}</td>
|
||||
<td>{{ key.ssh_key_size }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "SSH Fingerprint" %}</td>
|
||||
<td>{{ key.ssh_fingerprint }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
After this key is published to the keyservers, it can be signed using
|
||||
<a href="https://www.gnupg.org/">GnuPG</a> with the following commands:
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<pre>
|
||||
{% trans "# download the key" %}
|
||||
gpg --recv-key {{ key.pgp_fingerprint }}
|
||||
{% trans "# sign the key" %}
|
||||
gpg --sign-key {{ key.pgp_fingerprint }}
|
||||
{% trans "# send the key back to the keyservers" %}
|
||||
gpg --send-key {{ key.pgp_fingerprint }}
|
||||
</pre>
|
||||
|
||||
{% endblock %}
|
||||
@ -28,6 +28,8 @@ urlpatterns = [
|
||||
url(r'^sys/monkeysphere/$', views.index, name='index'),
|
||||
url(r'^sys/monkeysphere/(?P<domain>[^/]+)/generate/$',
|
||||
views.generate, name='generate'),
|
||||
url(r'^sys/monkeysphere/(?P<fingerprint>[0-9A-Fa-f]+)/details/$',
|
||||
views.details, name='details'),
|
||||
url(r'^sys/monkeysphere/(?P<fingerprint>[0-9A-Fa-f]+)/publish/$',
|
||||
views.publish, name='publish'),
|
||||
url(r'^sys/monkeysphere/cancel/$', views.cancel, name='cancel'),
|
||||
|
||||
@ -62,6 +62,13 @@ def generate(request, domain):
|
||||
return redirect(reverse_lazy('monkeysphere:index'))
|
||||
|
||||
|
||||
def details(request, fingerprint):
|
||||
"""Get details for an OpenPGP key."""
|
||||
key = get_key(fingerprint)
|
||||
return TemplateResponse(request, 'monkeysphere_details.html',
|
||||
{'title': _('Monkeysphere'), 'key': key})
|
||||
|
||||
|
||||
@require_POST
|
||||
def publish(request, fingerprint):
|
||||
"""Publish OpenPGP key for SSH service."""
|
||||
@ -104,6 +111,17 @@ def get_status():
|
||||
return {'domains': domains}
|
||||
|
||||
|
||||
def get_key(fingerprint):
|
||||
"""Get key by fingerprint."""
|
||||
output = actions.superuser_run('monkeysphere',
|
||||
['host-show-keys', fingerprint])
|
||||
if output:
|
||||
keys = json.loads(output)['keys']
|
||||
return keys[0]
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def _collect_publish_result(request):
|
||||
"""Handle publish process completion."""
|
||||
global publish_process
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user