diff options
Diffstat (limited to 'portal-gui')
-rw-r--r-- | portal-gui/Makefile.in | 84 | ||||
-rw-r--r-- | portal-gui/apache/rpki.conf.in | 10 | ||||
-rw-r--r-- | portal-gui/rpkigui/myrpki/glue.py.in (renamed from portal-gui/rpkigui/myrpki/glue.py) | 21 | ||||
-rw-r--r-- | portal-gui/rpkigui/settings.py.in | 7 | ||||
-rw-r--r-- | portal-gui/scripts/runserver.in | 24 | ||||
-rw-r--r-- | portal-gui/templates/base.html (renamed from portal-gui/rpkigui/templates/base.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/add_conf.html (renamed from portal-gui/rpkigui/templates/myrpki/add_conf.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/asn_view.html (renamed from portal-gui/rpkigui/templates/myrpki/asn_view.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/child_view.html (renamed from portal-gui/rpkigui/templates/myrpki/child_view.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/conf_empty.html (renamed from portal-gui/rpkigui/templates/myrpki/conf_empty.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/conf_list.html (renamed from portal-gui/rpkigui/templates/myrpki/conf_list.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/dashboard.html (renamed from portal-gui/rpkigui/templates/myrpki/dashboard.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/parent_resource.html (renamed from portal-gui/rpkigui/templates/myrpki/parent_resource.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/parent_view.html (renamed from portal-gui/rpkigui/templates/myrpki/parent_view.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/prefix_view.html (renamed from portal-gui/rpkigui/templates/myrpki/prefix_view.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/resource_view.html (renamed from portal-gui/rpkigui/templates/myrpki/resource_view.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/roaform.html (renamed from portal-gui/rpkigui/templates/myrpki/roaform.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/myrpki/xml_import.html (renamed from portal-gui/rpkigui/templates/myrpki/xml_import.html) | 0 | ||||
-rw-r--r-- | portal-gui/templates/registration/login.html (renamed from portal-gui/rpkigui/templates/registration/login.html) | 0 |
19 files changed, 59 insertions, 87 deletions
diff --git a/portal-gui/Makefile.in b/portal-gui/Makefile.in index ea6a4b25..0336c73a 100644 --- a/portal-gui/Makefile.in +++ b/portal-gui/Makefile.in @@ -5,8 +5,6 @@ abs_top_srcdir = @abs_top_srcdir@ abs_top_builddir = @abs_top_builddir@ srcdir=@srcdir@ - -# where to install the portal-gui prefix=@prefix@ exec_prefix=@exec_prefix@ datarootdir=@datarootdir@ @@ -15,23 +13,25 @@ localstatedir=@localstatedir@ sharedstatedir=@sharedstatedir@ bindir=@bindir@ sbindir=@sbindir@ +libexecdir=@libexecdir@ PYTHON=@PYTHON@ WEBUSER=@WEBUSER@ -CONFDIR=@CONFDIR@ SECRET_KEY=@SECRET_KEY@ -INSTDIR=$(datarootdir)/portal-gui -DATABASE_PATH=$(localstatedir)/portal-gui/rpkigui.db -MYRPKI=$(sbindir)/myrpki +INSTDIR=$(datarootdir)/rpki/gui +CONFDIR=$(localstatedir)/rpki/conf +DATABASE_PATH=$(localstatedir)/rpki/gui.db MEDIADIR=$(INSTDIR)/media -TEMPLATEDIR=$(INSTDIR)/rpkigui/templates +MYRPKI=$(sbindir)/myrpki +TEMPLATEDIR=$(INSTDIR)/templates # automatically built sources BUILD=rpkigui/settings.py \ rpkigui/urls.py \ - scripts/adduser \ + rpkigui/myrpki/glue.py \ scripts/list_resources \ + scripts/adduser \ scripts/load_csv \ apache/rpki.wsgi \ apache/rpki.conf @@ -42,8 +42,7 @@ clean: @true distclean: clean - rm -f rpkigui/settings.py rpkigui/urls.py - rm -f apache/rpki.wsgi apache/rpki.conf + rm -f $(BUILD) rm -f Makefile edit = sed \ @@ -60,6 +59,9 @@ edit = sed \ rpkigui/settings.py: $(srcdir)/rpkigui/settings.py.in Makefile $(edit) $@.in > $@ +rpkigui/myrpki/glue.py: $(srcdir)/rpkigui/myrpki/glue.py.in Makefile + $(edit) $@.in > $@ + rpkigui/urls.py: $(srcdir)/rpkigui/urls.py.in Makefile $(edit) $@.in > $@ @@ -79,9 +81,6 @@ scripts/adduser: $(srcdir)/scripts/adduser.py Makefile $(edit) $@.py > $@ INSTALL_FILES=\ - apache/rpki.wsgi \ - media/img/my.png \ - media/img/rpki.png \ rpkigui/__init__.py \ rpkigui/manage.py \ rpkigui/settings.py \ @@ -95,39 +94,50 @@ INSTALL_FILES=\ rpkigui/myrpki/misc.py \ rpkigui/myrpki/models.py \ rpkigui/myrpki/urls.py \ - rpkigui/myrpki/views.py \ - rpkigui/templates/base.html \ - rpkigui/templates/myrpki/asn_view.html \ - rpkigui/templates/myrpki/child_view.html \ - rpkigui/templates/myrpki/conf_empty.html \ - rpkigui/templates/myrpki/conf_list.html \ - rpkigui/templates/myrpki/dashboard.html \ - rpkigui/templates/myrpki/parent_view.html \ - rpkigui/templates/myrpki/prefix_view.html \ - rpkigui/templates/myrpki/xml_import.html \ - rpkigui/templates/registration/login.html \ - scripts/adduser \ - scripts/list_resources \ - scripts/load_csv + rpkigui/myrpki/views.py -.PHONY: install-perms install-data install +.PHONY: install-perms install-data install install-media install-django install-scripts install-templates install-perms: chown $(WEBUSER) `dirname $(DATABASE_PATH)` chown $(WEBUSER) $(DATABASE_PATH) + mkdir -p $(CONFDIR) chown -R $(WEBUSER) $(CONFDIR) -install-data: $(BUILD) - mkdir -p `dirname $(DATABASE_PATH)` - mkdir -p $(INSTDIR)/apache - mkdir -p $(INSTDIR)/media/img - mkdir -p $(INSTDIR)/rpkigui/myrpki - mkdir -p $(INSTDIR)/rpkigui/templates/myrpki - mkdir -p $(INSTDIR)/rpkigui/templates/registration - mkdir -p $(INSTDIR)/scripts +install-media: + install -D -m 644 media/img/my.png $(INSTDIR)/media/img + install -m 644 media/img/rpki.png $(INSTDIR)/media/img + +install-apache: + install -D -m 644 apache/rpki.conf $(INSTDIR)/apache + install -m 644 apache/rpki.wsgi $(INSTDIR)/apache + +install-templates: + install -D -m 644 templates/base.html $(TEMPLATEDIR) + install -D -m 644 templates/myrpki/asn_view.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/child_view.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/conf_empty.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/conf_list.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/dashboard.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/parent_view.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/prefix_view.html $(TEMPLATEDIR)/myrpki + install -m 644 templates/myrpki/xml_import.html $(TEMPLATEDIR)/myrpki + install -D -m 644 templates/registration/login.html $(TEMPLATEDIR)/registration + +#this will go away once the django app moves into the rpki module +install-django: for f in $(INSTALL_FILES); do \ - install $$f $(INSTDIR)/$$f; \ + install -D -m 644 $$f $(INSTDIR)/$$f; \ done + +install-scripts: + # user scripts + install -m 755 scripts/load_csv $(sbindir)/rpkigui-load-csv + install -m 755 scripts/adduser $(sbindir)/rpkigui-add-user + install -D -m 755 scripts/list_resources $(libexecdir)/rpkigui-list-resources + +install-data: $(BUILD) install-apache install-media install-templates install-scripts install-django + mkdir -p `dirname $(DATABASE_PATH)` cd $(INSTDIR)/rpkigui && $(PYTHON) manage.py syncdb install: install-data install-perms diff --git a/portal-gui/apache/rpki.conf.in b/portal-gui/apache/rpki.conf.in index fca4627f..7d5664fb 100644 --- a/portal-gui/apache/rpki.conf.in +++ b/portal-gui/apache/rpki.conf.in @@ -7,16 +7,6 @@ Order deny,allow Allow from all </Directory> -# enable http digest auth -#<Location /accounts/login> -#AuthType digest -#AuthName "rpki" -#AuthDigestDomain / -#AuthDigestProvider file -#AuthUserFile @INSTDIR@/htpasswd -#Require valid-user -#</Location> - # media for the /admin/ site Alias /media/ /usr/lib/python2.6/site-packages/django/contrib/admin/media/ <Directory /usr/lib/python2.6/site-packages/django/contrib/admin/media> 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/scripts/runserver.in b/portal-gui/scripts/runserver.in deleted file mode 100644 index 6e49c9f9..00000000 --- a/portal-gui/scripts/runserver.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# $Id$ -# -# Copyright (C) 2010 SPARTA, Inc. dba Cobham Analytic Solutions -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. -# -# -# Helper script to start the Django test webserver for the portal-gui. -# -# @configure_input@ - -cd @INSTDIR@/rpkigui -@PYTHON@ manage.py runserver --pythonpath=@MYRPKIDIR@ $* diff --git a/portal-gui/rpkigui/templates/base.html b/portal-gui/templates/base.html index 7645cf9f..7645cf9f 100644 --- a/portal-gui/rpkigui/templates/base.html +++ b/portal-gui/templates/base.html diff --git a/portal-gui/rpkigui/templates/myrpki/add_conf.html b/portal-gui/templates/myrpki/add_conf.html index a3440e4a..a3440e4a 100644 --- a/portal-gui/rpkigui/templates/myrpki/add_conf.html +++ b/portal-gui/templates/myrpki/add_conf.html diff --git a/portal-gui/rpkigui/templates/myrpki/asn_view.html b/portal-gui/templates/myrpki/asn_view.html index ef020355..ef020355 100644 --- a/portal-gui/rpkigui/templates/myrpki/asn_view.html +++ b/portal-gui/templates/myrpki/asn_view.html diff --git a/portal-gui/rpkigui/templates/myrpki/child_view.html b/portal-gui/templates/myrpki/child_view.html index 62709f0d..62709f0d 100644 --- a/portal-gui/rpkigui/templates/myrpki/child_view.html +++ b/portal-gui/templates/myrpki/child_view.html diff --git a/portal-gui/rpkigui/templates/myrpki/conf_empty.html b/portal-gui/templates/myrpki/conf_empty.html index 0ef9366c..0ef9366c 100644 --- a/portal-gui/rpkigui/templates/myrpki/conf_empty.html +++ b/portal-gui/templates/myrpki/conf_empty.html diff --git a/portal-gui/rpkigui/templates/myrpki/conf_list.html b/portal-gui/templates/myrpki/conf_list.html index 4bb18114..4bb18114 100644 --- a/portal-gui/rpkigui/templates/myrpki/conf_list.html +++ b/portal-gui/templates/myrpki/conf_list.html diff --git a/portal-gui/rpkigui/templates/myrpki/dashboard.html b/portal-gui/templates/myrpki/dashboard.html index af99e89e..af99e89e 100644 --- a/portal-gui/rpkigui/templates/myrpki/dashboard.html +++ b/portal-gui/templates/myrpki/dashboard.html diff --git a/portal-gui/rpkigui/templates/myrpki/parent_resource.html b/portal-gui/templates/myrpki/parent_resource.html index 764207e4..764207e4 100644 --- a/portal-gui/rpkigui/templates/myrpki/parent_resource.html +++ b/portal-gui/templates/myrpki/parent_resource.html diff --git a/portal-gui/rpkigui/templates/myrpki/parent_view.html b/portal-gui/templates/myrpki/parent_view.html index e1852245..e1852245 100644 --- a/portal-gui/rpkigui/templates/myrpki/parent_view.html +++ b/portal-gui/templates/myrpki/parent_view.html diff --git a/portal-gui/rpkigui/templates/myrpki/prefix_view.html b/portal-gui/templates/myrpki/prefix_view.html index 1e1ca797..1e1ca797 100644 --- a/portal-gui/rpkigui/templates/myrpki/prefix_view.html +++ b/portal-gui/templates/myrpki/prefix_view.html diff --git a/portal-gui/rpkigui/templates/myrpki/resource_view.html b/portal-gui/templates/myrpki/resource_view.html index f8219136..f8219136 100644 --- a/portal-gui/rpkigui/templates/myrpki/resource_view.html +++ b/portal-gui/templates/myrpki/resource_view.html diff --git a/portal-gui/rpkigui/templates/myrpki/roaform.html b/portal-gui/templates/myrpki/roaform.html index c81d0ae8..c81d0ae8 100644 --- a/portal-gui/rpkigui/templates/myrpki/roaform.html +++ b/portal-gui/templates/myrpki/roaform.html diff --git a/portal-gui/rpkigui/templates/myrpki/xml_import.html b/portal-gui/templates/myrpki/xml_import.html index e26830e3..e26830e3 100644 --- a/portal-gui/rpkigui/templates/myrpki/xml_import.html +++ b/portal-gui/templates/myrpki/xml_import.html diff --git a/portal-gui/rpkigui/templates/registration/login.html b/portal-gui/templates/registration/login.html index 86b5392a..86b5392a 100644 --- a/portal-gui/rpkigui/templates/registration/login.html +++ b/portal-gui/templates/registration/login.html |