diff options
Diffstat (limited to 'portal-gui/rpkigui')
16 files changed, 12 insertions, 598 deletions
diff --git a/portal-gui/rpkigui/myrpki/glue.py b/portal-gui/rpkigui/myrpki/glue.py.in index a07b9d7b..897b23d4 100644 --- a/portal-gui/rpkigui/myrpki/glue.py +++ b/portal-gui/rpkigui/myrpki/glue.py.in @@ -24,7 +24,6 @@ import csv import stat import sys -from django.conf import settings from django.db.models import F import rpki @@ -32,6 +31,11 @@ import rpki.config from rpkigui.myrpki import models +confdir = '@CONFDIR@' + +def conf(handle): + return confdir + '/' + handle + #def form_to_conf(data): # """Write out a rpki.conf based on the given form data.""" # handle = data['handle'] @@ -48,18 +52,17 @@ from rpkigui.myrpki import models def invoke_rpki(handle, args): """Invoke the myrpki cli for the specified configuration.""" - config = settings.MYRPKI_DATA_DIR + '/' + handle + '/rpki.conf' - myrpki_dir = settings.MYRPKI_DATA_DIR + '/' + handle + myrpki_dir = confdir(handle) + config = myrpki_dir + '/rpki.conf' # default rpki.conf uses relative paths, so chdir() to the repo first - cmd = 'cd %s && %s %s' % (myrpki_dir, settings.MYRPKI, - ' '.join(['--config=' + config] + args)) + cmd = 'cd %s && @MYRPKI@ %s' % (myrpki_dir, ' '.join(['--config=' + config] + args)) print >>sys.stderr, 'invoking', cmd os.system(cmd) def read_file_from_handle(handle, fname): """read a filename relative to the directory for the given resource handle. returns a tuple of (content, mtime)""" - with open(settings.MYRPKI_DATA_DIR + '/' + handle + '/' + fname, 'r') as fp: + with open(conf(handle) + '/' + fname, 'r') as fp: data = fp.read() mtime = os.fstat(fp.fileno())[stat.ST_MTIME] return data, mtime @@ -72,7 +75,7 @@ def read_file_from_handle(handle, fname): read_identity = lambda h: read_file_from_handle(h, 'entitydb/identity.xml')[0] def read_child_response(handle, child): - fname = '%s/%s/entitydb/children/%s.xml' % (settings.MYRPKI_DATA_DIR, handle, child) + fname = '%s/entitydb/children/%s.xml' % (conf(handle), child) with open(fname, 'r') as fp: data = fp.read() return data @@ -107,14 +110,14 @@ def output_roas(path, handle): def configure_daemons(handle): args = ['configure_daemons'] for hosted in handle.hosting.all(): - args.append(settings.MYRPKI_DATA_DIR + '/' + hosted.handle + '/myrpki.xml') + args.append(conf(hosted.handle) + '/myrpki.xml') invoke_rpki(handle.handle, args) def configure_resources(handle): '''Write out the csv files and invoke the myrpki.py command line tool.''' # chdir to the repo dir since the default rpki.conf uses relative # pathnames.. - os.chdir(settings.MYRPKI_DATA_DIR + '/' + handle.handle) + os.chdir(conf(handle.handle)) cfg = rpki.config.parser('rpki.conf', 'myrpki') output_asns(cfg.get('asn_csv'), handle) output_prefixes(cfg.get('prefix_csv'), handle) diff --git a/portal-gui/rpkigui/settings.py.in b/portal-gui/rpkigui/settings.py.in index f369adbe..ef7d4541 100644 --- a/portal-gui/rpkigui/settings.py.in +++ b/portal-gui/rpkigui/settings.py.in @@ -103,12 +103,5 @@ AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) -# Top of directory tree where rpki.conf, etc are stored for each -# resource holder. -MYRPKI_DATA_DIR = '@CONFDIR@' - -# Where to find the myrpki command line tool. -MYRPKI = '@MYRPKI@' - # where to redirect from /accounts/login/ after successful authentication LOGIN_REDIRECT_URL = '/myrpki/' diff --git a/portal-gui/rpkigui/templates/base.html b/portal-gui/rpkigui/templates/base.html deleted file mode 100644 index 7645cf9f..00000000 --- a/portal-gui/rpkigui/templates/base.html +++ /dev/null @@ -1,25 +0,0 @@ -<html> -<head> - <title>{% block title %}MyRPKI{% endblock %}</title> - {% block head %}{% endblock %} - <style type="text/css"> - {% block css %}{% endblock %} - </style> -</head> -<body> - <div id="header"> - <img src="/site_media/img/my.png"/> - <img src="/site_media/img/rpki.png"/> - </div> - <div id="content"> - {% if user.is_authenticated %} - <span style="float: right; font-size: 80%;">Logged in as {{ user }} | - {% if user.is_staff %}<a href="/admin/">admin</a> |{% endif %} - <a href="{% url django.contrib.auth.views.logout %}">Log Out</a></span> - {% else %} - <span style="float: right; font-size: 80%;"><a href="{% url django.contrib.auth.views.login %}">Log In</a></span> - {% endif %} - {% block content %}{% endblock %} - </div> -</body> -</html> diff --git a/portal-gui/rpkigui/templates/myrpki/add_conf.html b/portal-gui/rpkigui/templates/myrpki/add_conf.html deleted file mode 100644 index a3440e4a..00000000 --- a/portal-gui/rpkigui/templates/myrpki/add_conf.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<h1>Add Configuration</h1> -<p>Please enter a unique handle for your RPKI instance. - -{% if errors %} -<ul> -{% for m in errors %} -<li class="errmsg">{{ m }} -{% endfor %} -</ul> -{% endif %} - -<form action="/myrpki/conf/add" method="post"> -<table> -{{ form.as_table }} -<tr><td><input type="submit" value="Submit" /></td></tr> -</table> -</form> - -{% endblock %} -{% extends "base.html" %} diff --git a/portal-gui/rpkigui/templates/myrpki/asn_view.html b/portal-gui/rpkigui/templates/myrpki/asn_view.html deleted file mode 100644 index ef020355..00000000 --- a/portal-gui/rpkigui/templates/myrpki/asn_view.html +++ /dev/null @@ -1,87 +0,0 @@ -{% extends "base.html" %} - -{% block css %} -table { border-collapse: collapse } -th { border: solid 1px; padding: 1em } -td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1em } -{% endblock %} - -{% block content %} -<p>Handle: <a href="{% url rpkigui.myrpki.views.dashboard %}">{{ request.session.handle }}</a> - -<h1>ASN View</h1> - -<table> - <tr> <td>ASN:</td><td>{{ asn }}</td> </tr> - {% if asn.parent %} - <tr> - <td>Suballocated from:</td> - <td><a href="{{ asn.parent.get_absolute_url }}">{{ asn.parent }}</a></td> - </tr> - {% endif %} - <tr> - <td>Received from:</td> - <td> - {% for p in parent %} - <a href="{{ p.get_absolute_url }}">{{ p.handle }}</a> - {% endfor %} - </td> - </tr> - <tr><td>Validity:</td><td>{{ asn.from_cert.all.0.not_before }} - {{ asn.from_cert.all.0.not_after }} </td></tr> - - {% if asn.allocated %} - <tr><td>Allocated:</td><td><a href="{{asn.allocated.get_absolute_url}}">{{asn.allocated.handle}}</a></td></tr> - {% endif %} -</table> - -{% if asn.children.count %} -<h2>Suballocations</h2> - -<ul> -{% for subaddr in asn.children.all %} -<li><a href="{{ subaddr.get_absolute_url }}">{{ subaddr }}</a> -{% endfor %} -</ul> - -{% endif %} - -{% if roas %} -<h2>ROAs</h2> -<table> - <tr><th>Prefixes</th></tr> - {% for r in roas %} - <tr> - <td style='text-align: left'> - <ul> - {% for p in r.from_roa_request.all %} - <li><a href="{{ p.prefix.get_absolute_url }}">{{ p.prefix }}</a> - {% endfor %} - </ul> - </td> - </tr> - {% endfor %} - </ul> -</table> -{% endif %} <!-- roas --> - -{% if unallocated %} -<h2>Unallocated</h2> -<ul> -{% for u in unallocated %} -<li>{{ u }} -{% endfor %} -</ul> -{% endif %} - -{% if form %} -<h2>Edit</h2> -<form method="POST" action="{{ request.get_full_path }}"> - {{ form.as_p }} - <input type="submit"> -</form> -{% endif %} - -<p>Action: -<a href="{{asn.get_absolute_url}}/allocate">give to child</a> - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/child_view.html b/portal-gui/rpkigui/templates/myrpki/child_view.html deleted file mode 100644 index 62709f0d..00000000 --- a/portal-gui/rpkigui/templates/myrpki/child_view.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<p>Handle: <a href="{% url rpkigui.myrpki.views.dashboard %}">{{ request.session.handle.handle }}</a> -<h1>Child View</h1> -<p>Child: {{ child.handle }} - -<h2>Delegated Addresses</h2> -{% if child.address_range.all %} -<ul> -{% for a in child.address_range.all %} -<li><a href="{{ a.get_absolute_url }}">{{ a }}</a> -{% endfor %} -</ul> -{% else %} -<p>--none-- -{% endif %} - -<h2>Delegated ASNs</h2> -{% if child.asn.all %} -<ul> -{% for a in child.asn.all %} -<li><a href="{{ a.get_absolute_url }}">{{ a }}</a> -{% endfor %} -</ul> -{% else %} -<p>--none-- -{% endif %} - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/conf_empty.html b/portal-gui/rpkigui/templates/myrpki/conf_empty.html deleted file mode 100644 index 0ef9366c..00000000 --- a/portal-gui/rpkigui/templates/myrpki/conf_empty.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} - -{% block content %} - -<h1>Error!</h1> -<p>Your account does not have permission to manage any resource handles on this server. Please contact your portal-gui operator. - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/conf_list.html b/portal-gui/rpkigui/templates/myrpki/conf_list.html deleted file mode 100644 index 4bb18114..00000000 --- a/portal-gui/rpkigui/templates/myrpki/conf_list.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<h1>Handle List</h1> -<p>Please select a handle.</p> - -<ul> -{% for c in conf_list %} -<li><a href="{{ select_url }}?handle={{ c.handle }}&next={{ next_url }}">{{ c.handle }}</a></li> -{% endfor %} -</ul> - -<!-- -<p><a href="/myrpki/conf/add?next={{ next_url }}">[create]</a> ---> - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/dashboard.html b/portal-gui/rpkigui/templates/myrpki/dashboard.html deleted file mode 100644 index af99e89e..00000000 --- a/portal-gui/rpkigui/templates/myrpki/dashboard.html +++ /dev/null @@ -1,135 +0,0 @@ -{% extends "base.html" %} - -{% block css %} -table { border-collapse: collapse } -th { border: solid 1px; padding: 1em } -td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1em } -{% endblock %} - -{% block content %} -<p>Handle: {{ request.session.handle }} -| <a href="{% url rpkigui.myrpki.views.conf_export %}">export identity</a> -| <a href="{% url rpkigui.myrpki.views.conf_list %}">select</a> - -<div style="border: inset"> -<h1 style="text-align: center">Parents</h1> - -<ul> -{% for parent in request.session.handle.parents.all %} -<li><a href="{{ parent.get_absolute_url }}">{{ parent.handle }}</a> -<p> -<table> -<tr><th>Accepted Resource</th><th>Not Before</th><th>Not After</th></tr> -{% for cert in parent.resources.all %} - -{% for asn in cert.asn.all %} -<tr><td style='text-align:left'><a href="{{ asn.get_absolute_url }}">{{ asn }}</a></td> -<td>{{cert.not_before}}</td> -<td>{{cert.not_after}}</td> -</tr> -{% endfor %} - -{% for address in cert.address_range.all %} -<tr> - <td style='text-align: left'><a href="{{ address.get_absolute_url }}">{{ address }}</a></td> - <td>{{cert.not_before}}</td> - <td>{{cert.not_after}}</td> -</tr> -{% endfor %} - -{% endfor %} <!--certs--> -</table> - -{% endfor %} -</ul> - -<!-- -<a href="/myrpki/import/parent">[add]</a> ---> -</div> - -<span> -<div style="border: outset"> -<h1 style="text-align: center">Children</h1> -{% if request.session.handle.children.all %} -<ul> -{% for child in request.session.handle.children.all %} -<li><a href="{% url rpkigui.myrpki.views.child_view child.handle %}">{{ child.handle }}</a> -{% if child.address_range.count or child.asn.count %} -<p>Delegated resources: -<ul> -{% for asn in child.asn.all %} -<li><a href="{{ asn.get_absolute_url }}">{{ asn }}</a> -{% endfor %} -{% for address in child.address_range.all %} -<li><a href="{{ address.get_absolute_url}}">{{ address }}</a> -{% endfor %} -</ul> -{% endif %} -{% endfor %} -</ul> -<!-- -<a href="/myrpki/import/child">[add]</a> ---> -{% else %} -<p>-- none -- -{% endif %} - -<p> -Export (csv): <a href="{% url rpkigui.myrpki.views.download_asns request.session.handle %}">asns</a> | -<a href="{% url rpkigui.myrpki.views.download_prefixes request.session.handle %}">prefixes</a> - -</div> - -<div style="border: outset"> <!-- ROAs --> -<h1 style="text-align: center">My ROA [request]s</h1> - -<table> -<tr> <th>Prefix</th> <th>ASN</th> </tr> - -{% for roa in request.session.handle.roas.all %} -<tr> - <td style='text-align: left'> - <ul style='list-style-position: outside'> -{% for req in roa.from_roa_request.all %} - <li><a href="{{ req.prefix.get_absolute_url }}">{{ req.as_roa_prefix }}</a> -{% endfor %} - </ul> - </td> - <td>{{ roa.asn }}</td> -</tr> -{% endfor %} -</table> - -<p><a href="{% url rpkigui.myrpki.views.download_roas request.session.handle %}">export (csv)</a> - -</div><!-- roas --> - -<div style="border: outset"> - <h1 style="text-align: center">Unallocated Resources</h1> - {% if asns or ars %} - - {% if asns %} - <ul> - {% for asn in asns %} - <li>{{ asn.as_ul|safe }} - {% endfor %} <!-- ASNs --> - </ul> - {% endif %} - - {% if ars %} - <ul> - {% for addr in ars %} - <li>{{ addr.as_ul|safe }} - {% endfor %} <!-- addrs --> - </ul> - {% endif %} - - {% else %} - <p>-- none -- - {% endif %} - - </ul> -</div> -</span> -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/parent_resource.html b/portal-gui/rpkigui/templates/myrpki/parent_resource.html deleted file mode 100644 index 764207e4..00000000 --- a/portal-gui/rpkigui/templates/myrpki/parent_resource.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} - -{% block content %} - -<p>Handle: <a href="/myrpki/">{{ request.session.handle }}</a> - -<h1>Add Resource Range</h1> -<form action="{{ request.url }}" method="post"> -<table> -{{ form.as_table }} -</table> -<input type="submit" value="Submit" /> -</form> - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/parent_view.html b/portal-gui/rpkigui/templates/myrpki/parent_view.html deleted file mode 100644 index e1852245..00000000 --- a/portal-gui/rpkigui/templates/myrpki/parent_view.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<p>Handle: <a href="{% url rpkigui.myrpki.views.dashboard %}">{{ request.session.handle.handle }}</a> -<h1>Parent View</h1> -<p>Parent: {{ parent.handle }} -<h2>Delegated Addresses</h2> -<ul> -{% for c in parent.resources.all %} -{% for a in c.address_range.all %} -<li><a href="{{ a.get_absolute_url }}">{{ a }}</a> -{% endfor %} -{% endfor %} -</ul> - -<h2>Delegated ASNs</h2> -<ul> -{% for c in parent.resources.all %} -{% for a in c.asn.all %} -<li><a href="{{ a.get_absolute_url }}">{{ a }}</a> -{% endfor %} -{% endfor %} -</ul> - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/prefix_view.html b/portal-gui/rpkigui/templates/myrpki/prefix_view.html deleted file mode 100644 index 1e1ca797..00000000 --- a/portal-gui/rpkigui/templates/myrpki/prefix_view.html +++ /dev/null @@ -1,95 +0,0 @@ -{% extends "base.html" %} - -{% block css %} -table { border: solid 1px; border-collapse: collapse } -th { border: solid 1px; padding: 1em } -td { border: solid 1px; text-align: center; padding-left: 1em; padding-right: 1em } -{% endblock %} - -{% block content %} -<p>Handle: <a href="{% url rpkigui.myrpki.views.dashboard %}">{{ request.session.handle }}</a> - -<h1>Prefix View</h1> - -<table> - <tr> <td>Range:</td><td>{{ addr }}</td> </tr> - {% if addr.parent %} - <tr> - <td>Suballocated from:</td> - <td><a href="{{ addr.parent.get_absolute_url }}">{{ addr.parent }}</a></td> - </tr> - {% endif %} - <tr> - <td>Received from:</td> - <td> - {% for p in parent %} - <a href="{{ p.get_absolute_url }}">{{ p.handle }}</a> - {% endfor %} - </td> - </tr> - <tr><td>Validity:</td><td>{{ addr.from_cert.all.0.not_before }} - {{ addr.from_cert.all.0.not_after }} </td></tr> - - {% if addr.allocated %} - <tr> - <td>Allocated:</td> - <td><a href="{{addr.allocated.get_absolute_url}}">{{ addr.allocated.handle }}</a></td> - </tr> - {% endif %} -</table> - -{% if addr.children.count %} -<h2>Suballocations</h2> -<ul> -{% for subaddr in addr.children.all %} - <li><a href="{{ subaddr.get_absolute_url }}">{{ subaddr }}</a> -{% endfor %} -</ul> -{% endif %} <!-- suballocations --> - -{% if addr.roa_requests.count %} -<h2>ROA requests</h2> -<table> - <tr><th>ASN</th><th>Max Length</th></tr> - - {% for r in addr.roa_requests.all %} - <tr> - <td>{{ r.roa.asn }}</td> - <td>{{ r.max_length }}</td> - <td><a href="{{ r.get_absolute_url }}/delete">delete</a></td> - </tr> - {% endfor %} -</table> -{% endif %} <!-- roa requests --> - -{% if unallocated %} -<h2>Unallocated</h2> -<ul> - {% for u in unallocated %} - <li>{{ u }} - {% endfor %} -</ul> -{% endif %} - -{% if form %} -<h2>Edit</h2> -<form method="POST" action="{{ request.get_full_path }}"> - {{ form.as_p }} - <input type="submit"> -</form> -{% endif %} <!-- form --> - -<p>Action:<br> -{% if not addr.allocated %} -<a href="{{addr.get_absolute_url}}/split">split</a><br> -{% endif %} -{% if not addr.roa_requests.all %} -<a href="{{addr.get_absolute_url}}/allocate">give to child</a><br> -{% endif %} -{% if addr.is_prefix and not addr.allocated %} -<a href="{{ addr.get_absolute_url }}/roa">roa</a><br> -{% endif %} -{% if not addr.allocated and addr.parent %} -<a href="{{ addr.get_absolute_url }}/delete">delete</a><br> -{% endif %} - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/resource_view.html b/portal-gui/rpkigui/templates/myrpki/resource_view.html deleted file mode 100644 index f8219136..00000000 --- a/portal-gui/rpkigui/templates/myrpki/resource_view.html +++ /dev/null @@ -1,63 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<p>Handle: <a href="/myrpki/">{{ request.session.handle }}</a> -<h1>{{resource_type.capitalize}} View</h1> -<table> - <tr> - <td>Range:</td><td>{{ addr }}</td> - </tr> - <tr> - <td>Received from:</td> - <td> - {% for p in parent %} - <a href="{{ p.get_absolute_url }}">{{ p.handle }}</a> - {% endfor %} - </td> - </tr> - <tr><td>Validity:</td><td>{{ addr.from_cert.all.0.not_before }} - {{ addr.from_cert.all.0.not_after }} </td></tr> - {% if addr.parent %} - <tr> - <td>Suballocated from:</td> - <td><a href="{{ addr.parent.get_absolute_url }}">{{ addr.parent }}</a></td> - </tr> - {% endif %} -</table> - -<h2>Suballocations</h2> - -{% if addr.children.count %} - -<ul> -{% for subaddr in addr.children.all %} -<li><a href="{{ subaddr.get_absolute_url }}">{{ subaddr }}</a> -{% endfor %} -</ul> - -{% else %} - -<p>--none-- - -{% endif %} - -<div> -<h2>Delegate</h2> - -<p>Child: -<!-- -<form action="{{ request.url }}" method="post"> - {{ form.as_p }} - <p><input type="submit" value="Submit"> -</form> ---> -</div> - -{% if resource_type == 'prefix' %} -<div> -<h2>Originate</h2> -<p>ASNs allowed to originate routes for this prefix: -</div> - -{% endif %} - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/roaform.html b/portal-gui/rpkigui/templates/myrpki/roaform.html deleted file mode 100644 index c81d0ae8..00000000 --- a/portal-gui/rpkigui/templates/myrpki/roaform.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<h1>Edit ROA</h1> - -<p>Handle: <a href="/myrpki/">{{ request.session.handle }}</a> - -<form action="{{ request.url }}" method="POST"> -{{ form.as_p }} -<p><input type="submit" value="Submit"> -</form> - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/myrpki/xml_import.html b/portal-gui/rpkigui/templates/myrpki/xml_import.html deleted file mode 100644 index e26830e3..00000000 --- a/portal-gui/rpkigui/templates/myrpki/xml_import.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -<h1>Import {{ kind }}</h1> -<p>Handle: {{ request.session.handle }} -<p>Please select the xml file containing the identity of the <strong>{{ kind }}</strong> to import. -{% if errors %} -<ul> -{% for e in errors %} -<li>{{ e }} -{% endfor %} -</ul> -{% endif %} - -<form enctype="multipart/form-data" action="{{ post_url }}" method="post"> -{{ form.as_p }} -<input type="submit" value="Submit" /> -</form> - -{% endblock %} diff --git a/portal-gui/rpkigui/templates/registration/login.html b/portal-gui/rpkigui/templates/registration/login.html deleted file mode 100644 index 86b5392a..00000000 --- a/portal-gui/rpkigui/templates/registration/login.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "base.html" %} - -{% block content %} - -{% if form.errors %} -<p>Your username and password didn't match. Please try again.</p> -{% endif %} - -<form method="post" action="{% url django.contrib.auth.views.login %}"> -<table> -<tr> - <td>{{ form.username.label_tag }}</td> - <td>{{ form.username }}</td> -</tr> -<tr> - <td>{{ form.password.label_tag }}</td> - <td>{{ form.password }}</td> -</tr> -</table> - -<input type="submit" value="login" /> -<input type="hidden" name="next" value="{{ next }}" /> -</form> - -{% endblock %} - |