aboutsummaryrefslogtreecommitdiff
path: root/rpkid/portal-gui
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/portal-gui')
-rw-r--r--rpkid/portal-gui/Makefile.in56
-rw-r--r--rpkid/portal-gui/apache.conf.in (renamed from rpkid/portal-gui/apache/rpki.conf.in)16
-rw-r--r--rpkid/portal-gui/apache/rpki.wsgi.in23
-rw-r--r--rpkid/portal-gui/manage.py11
-rw-r--r--rpkid/portal-gui/media/css/bootstrap.min.css356
-rw-r--r--rpkid/portal-gui/media/img/my.pngbin10307 -> 0 bytes
-rw-r--r--rpkid/portal-gui/media/img/rpki.pngbin28820 -> 0 bytes
-rw-r--r--rpkid/portal-gui/rpki.wsgi.in54
-rw-r--r--rpkid/portal-gui/scripts/adduser.py86
-rwxr-xr-xrpkid/portal-gui/scripts/dumpdata.py43
-rw-r--r--rpkid/portal-gui/scripts/list_resources.py200
-rwxr-xr-xrpkid/portal-gui/scripts/load_csv.py143
-rwxr-xr-xrpkid/portal-gui/scripts/roa_check.py71
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-import-routes.py250
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-rcynic.py363
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-reset-demo.py34
-rwxr-xr-xrpkid/portal-gui/scripts/rpkigui-response.py70
-rw-r--r--rpkid/portal-gui/settings.py.in38
18 files changed, 969 insertions, 845 deletions
diff --git a/rpkid/portal-gui/Makefile.in b/rpkid/portal-gui/Makefile.in
index fa4e1e46..d4b7c5dc 100644
--- a/rpkid/portal-gui/Makefile.in
+++ b/rpkid/portal-gui/Makefile.in
@@ -16,21 +16,13 @@ sbindir=@sbindir@
libexecdir=@libexecdir@
sysconfdir=@sysconfdir@
-WEBUSER=@WEBUSER@
-DJANGO_ADMIN=@DJANGO_ADMIN@
-PYTHON=@PYTHON@
-DJANGO_DIR=@DJANGO_DIR@
-
INSTALL = @INSTALL@
-CONFDIR=${DESTDIR}$(localstatedir)/rpki/conf
-DATABASE_PATH=${DESTDIR}$(localstatedir)/rpki/gui.db
-INSTDIR=${DESTDIR}$(datarootdir)/rpki/gui
-STATIC_DIR=${INSTDIR}/static
-PYTHONPATH=${DESTDIR}${sysconfdir}/rpki
+INSTDIR=${DESTDIR}$(datarootdir)/rpki
+SYSCONFDIR=${DESTDIR}${sysconfdir}/rpki
# automatically built sources
-BUILD=apache/rpki.conf
+BUILD=apache.conf
all: $(BUILD)
@@ -42,41 +34,25 @@ distclean: clean
rm -f Makefile
edit = sed \
- -e 's|@DJANGO_DIR[@]|$(DJANGO_DIR)|g' \
- -e 's|@INSTDIR[@]|$(INSTDIR)|g' \
- -e 's|@STATIC_DIR[@]|$(STATIC_DIR)|g'
+ -e 's|@INSTDIR[@]|$(INSTDIR)|g'
-apache/rpki.conf: $(srcdir)/apache/rpki.conf.in Makefile
+apache.conf: $(srcdir)/apache.conf.in Makefile
$(edit) $@.in > $@
-.PHONY: install-perms install-data install
-
-install-perms:
- chown $(WEBUSER) `dirname $(DATABASE_PATH)`
- chown $(WEBUSER) $(DATABASE_PATH)
- mkdir -p $(CONFDIR)
- chown -R $(WEBUSER) $(CONFDIR)
-
-install-apache:
- ${INSTALL} -d -m 755 $(INSTDIR)/apache
- ${INSTALL} -m 644 apache/rpki.conf $(INSTDIR)/apache
- ${INSTALL} -m 644 apache/rpki.wsgi $(INSTDIR)/apache
-
-install-data: $(BUILD) install-apache
- mkdir -p `dirname $(DATABASE_PATH)`
- mkdir -p ${PYTHONPATH}
+install: $(BUILD)
+ ${INSTALL} -d $(SYSCONFDIR)
+ ${INSTALL} -d $(INSTDIR)/media/css
+ ${INSTALL} -d $(INSTDIR)/wsgi
+ ${INSTALL} -m 644 apache.conf $(SYSCONFDIR)/apache.conf
+ ${INSTALL} -m 644 $(srcdir)/media/css/bootstrap.min.css $(INSTDIR)/media/css/bootstrap.min.css
+ ${INSTALL} -m 644 rpki.wsgi $(INSTDIR)/wsgi/rpki.wsgi
# FIXME should eventually try to merge new settings?
- @if [ ! -f ${PYTHONPATH}/settings.py ]; then \
- ${INSTALL} -m 644 settings.py ${PYTHONPATH}; \
+ @if [ ! -f ${SYSCONFDIR}/settings.py ]; then \
+ ${INSTALL} -m 644 settings.py ${SYSCONFDIR}; \
else \
- echo "${PYTHONPATH}/settings.py already exists, installing settings.py as ${PYTHONPATH}/settings.py.new"; \
- ${INSTALL} -m 644 settings.py ${PYTHONPATH}/settings.py.new; \
+ echo "${SYSCONFDIR}/settings.py already exists, installing settings.py as ${SYSCONFDIR}/settings.py.new"; \
+ ${INSTALL} -m 644 settings.py ${SYSCONFDIR}/settings.py.new; \
fi
- $(DJANGO_ADMIN) syncdb --pythonpath ${PYTHONPATH} --settings settings
- #$(DJANGO_ADMIN) collectstatic --noinput --pythonpath ${PYTHONPATH} --settings settings
- if [ ! -f $(INSTDIR)/rpki.conf.template ]; then ${INSTALL} -m 644 ../examples/rpki.conf $(INSTDIR)/rpki.conf.template; fi
-
-install: install-data install-perms
deinstall uninstall:
rm -rf $(INSTDIR)
diff --git a/rpkid/portal-gui/apache/rpki.conf.in b/rpkid/portal-gui/apache.conf.in
index 9318549a..b9ca7a36 100644
--- a/rpkid/portal-gui/apache/rpki.conf.in
+++ b/rpkid/portal-gui/apache.conf.in
@@ -13,20 +13,14 @@
#
# Defines the URL to the portal-gui
#
-WSGIScriptAlias / @INSTDIR@/apache/rpki.wsgi
-<Directory @INSTDIR@/rpkigui>
+WSGIScriptAlias / @INSTDIR@/wsgi/rpki.wsgi
+
+<Directory @INSTDIR@/media>
Order deny,allow
Allow from all
</Directory>
-# for use with Django 1.3+
-#Alias /static/ @STATIC_DIR@/
-#<Directory @STATIC_DIR@>
-#Order allow,deny
-#Allow from all
-#</Directory>
-
-# for use with Django 1.2
-#Alias /media/ /var/www/html/media/
+Alias /media/ @INSTDIR@/media/
+Alias /site_media/ @INSTDIR@/media/
# vim:ft=apache
diff --git a/rpkid/portal-gui/apache/rpki.wsgi.in b/rpkid/portal-gui/apache/rpki.wsgi.in
deleted file mode 100644
index 8cddef95..00000000
--- a/rpkid/portal-gui/apache/rpki.wsgi.in
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-"""
-Copyright (C) 2010, 2011 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.
-
-
-This is an example wsgi application for use with mod_wsgi and apache.
-
-"""
-
-import django.core.handlers.wsgi
-application = django.core.handlers.wsgi.WSGIHandler()
diff --git a/rpkid/portal-gui/manage.py b/rpkid/portal-gui/manage.py
deleted file mode 100644
index 5e78ea97..00000000
--- a/rpkid/portal-gui/manage.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- execute_manager(settings)
diff --git a/rpkid/portal-gui/media/css/bootstrap.min.css b/rpkid/portal-gui/media/css/bootstrap.min.css
new file mode 100644
index 00000000..617c87f2
--- /dev/null
+++ b/rpkid/portal-gui/media/css/bootstrap.min.css
@@ -0,0 +1,356 @@
+html,body{margin:0;padding:0;}
+h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,cite,code,del,dfn,em,img,q,s,samp,small,strike,strong,sub,sup,tt,var,dd,dl,dt,li,ol,ul,fieldset,form,label,legend,button,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;font-weight:normal;font-style:normal;font-size:100%;line-height:1;font-family:inherit;}
+table{border-collapse:collapse;border-spacing:0;}
+ol,ul{list-style:none;}
+q:before,q:after,blockquote:before,blockquote:after{content:"";}
+html{overflow-y:scroll;font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
+a:focus{outline:thin dotted;}
+a:hover,a:active{outline:0;}
+article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;}
+audio,canvas,video{display:inline-block;*display:inline;*zoom:1;}
+audio:not([controls]){display:none;}
+sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}
+sup{top:-0.5em;}
+sub{bottom:-0.25em;}
+img{border:0;-ms-interpolation-mode:bicubic;}
+button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;}
+button,input{line-height:normal;*overflow:visible;}
+button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}
+button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;}
+input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}
+input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}
+textarea{overflow:auto;vertical-align:top;}
+body{background-color:#ffffff;margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:18px;color:#404040;}
+.container{width:940px;margin-left:auto;margin-right:auto;zoom:1;}.container:before,.container:after{display:table;content:"";zoom:1;}
+.container:after{clear:both;}
+.container-fluid{position:relative;min-width:940px;padding-left:20px;padding-right:20px;zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";zoom:1;}
+.container-fluid:after{clear:both;}
+.container-fluid>.sidebar{position:absolute;top:0;left:20px;width:220px;}
+.container-fluid>.content{margin-left:240px;}
+a{color:#0069d6;text-decoration:none;line-height:inherit;font-weight:inherit;}a:hover{color:#00438a;text-decoration:underline;}
+.pull-right{float:right;}
+.pull-left{float:left;}
+.hide{display:none;}
+.show{display:block;}
+.row{zoom:1;margin-left:-20px;}.row:before,.row:after{display:table;content:"";zoom:1;}
+.row:after{clear:both;}
+.row>[class*="span"]{display:inline;float:left;margin-left:20px;}
+.span1{width:40px;}
+.span2{width:100px;}
+.span3{width:160px;}
+.span4{width:220px;}
+.span5{width:280px;}
+.span6{width:340px;}
+.span7{width:400px;}
+.span8{width:460px;}
+.span9{width:520px;}
+.span10{width:580px;}
+.span11{width:640px;}
+.span12{width:700px;}
+.span13{width:760px;}
+.span14{width:820px;}
+.span15{width:880px;}
+.span16{width:940px;}
+.span17{width:1000px;}
+.span18{width:1060px;}
+.span19{width:1120px;}
+.span20{width:1180px;}
+.span21{width:1240px;}
+.span22{width:1300px;}
+.span23{width:1360px;}
+.span24{width:1420px;}
+.row>.offset1{margin-left:80px;}
+.row>.offset2{margin-left:140px;}
+.row>.offset3{margin-left:200px;}
+.row>.offset4{margin-left:260px;}
+.row>.offset5{margin-left:320px;}
+.row>.offset6{margin-left:380px;}
+.row>.offset7{margin-left:440px;}
+.row>.offset8{margin-left:500px;}
+.row>.offset9{margin-left:560px;}
+.row>.offset10{margin-left:620px;}
+.row>.offset11{margin-left:680px;}
+.row>.offset12{margin-left:740px;}
+.span-one-third{width:300px;}
+.span-two-thirds{width:620px;}
+.row>.offset-one-third{margin-left:340px;}
+.row>.offset-two-thirds{margin-left:660px;}
+p{font-size:13px;font-weight:normal;line-height:18px;margin-bottom:9px;}p small{font-size:11px;color:#bfbfbf;}
+h1,h2,h3,h4,h5,h6{font-weight:bold;color:#404040;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{color:#bfbfbf;}
+h1{margin-bottom:18px;font-size:30px;line-height:36px;}h1 small{font-size:18px;}
+h2{font-size:24px;line-height:36px;}h2 small{font-size:14px;}
+h3,h4,h5,h6{line-height:36px;}
+h3{font-size:18px;}h3 small{font-size:14px;}
+h4{font-size:16px;}h4 small{font-size:12px;}
+h5{font-size:14px;}
+h6{font-size:13px;color:#bfbfbf;text-transform:uppercase;}
+ul,ol{margin:0 0 18px 25px;}
+ul ul,ul ol,ol ol,ol ul{margin-bottom:0;}
+ul{list-style:disc;}
+ol{list-style:decimal;}
+li{line-height:18px;color:#808080;}
+ul.unstyled{list-style:none;margin-left:0;}
+dl{margin-bottom:18px;}dl dt,dl dd{line-height:18px;}
+dl dt{font-weight:bold;}
+dl dd{margin-left:9px;}
+hr{margin:20px 0 19px;border:0;border-bottom:1px solid #eee;}
+strong{font-style:inherit;font-weight:bold;}
+em{font-style:italic;font-weight:inherit;line-height:inherit;}
+.muted{color:#bfbfbf;}
+blockquote{margin-bottom:18px;border-left:5px solid #eee;padding-left:15px;}blockquote p{font-size:14px;font-weight:300;line-height:18px;margin-bottom:0;}
+blockquote small{display:block;font-size:12px;font-weight:300;line-height:18px;color:#bfbfbf;}blockquote small:before{content:'\2014 \00A0';}
+address{display:block;line-height:18px;margin-bottom:18px;}
+code,pre{padding:0 3px 2px;font-family:Monaco, Andale Mono, Courier New, monospace;font-size:12px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
+code{background-color:#fee9cc;color:rgba(0, 0, 0, 0.75);padding:1px 3px;}
+pre{background-color:#f5f5f5;display:block;padding:8.5px;margin:0 0 18px;line-height:18px;font-size:12px;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;white-space:pre;white-space:pre-wrap;word-wrap:break-word;}
+form{margin-bottom:18px;}
+fieldset{margin-bottom:18px;padding-top:18px;}fieldset legend{display:block;padding-left:150px;font-size:19.5px;line-height:1;color:#404040;*padding:0 0 5px 145px;*line-height:1.5;}
+form .clearfix{margin-bottom:18px;zoom:1;}form .clearfix:before,form .clearfix:after{display:table;content:"";zoom:1;}
+form .clearfix:after{clear:both;}
+label,input,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:normal;}
+label{padding-top:6px;font-size:13px;line-height:18px;float:left;width:130px;text-align:right;color:#404040;}
+form .input{margin-left:150px;}
+input[type=checkbox],input[type=radio]{cursor:pointer;}
+input,textarea,select,.uneditable-input{display:inline-block;width:210px;height:18px;padding:4px;font-size:13px;line-height:18px;color:#808080;border:1px solid #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
+select{padding:initial;}
+input[type=checkbox],input[type=radio]{width:auto;height:auto;padding:0;margin:3px 0;*margin-top:0;line-height:normal;border:none;}
+input[type=file]{background-color:#ffffff;padding:initial;border:initial;line-height:initial;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
+input[type=button],input[type=reset],input[type=submit]{width:auto;height:auto;}
+select,input[type=file]{height:27px;*height:auto;line-height:27px;*margin-top:4px;}
+select[multiple]{height:inherit;background-color:#ffffff;}
+textarea{height:auto;}
+.uneditable-input{background-color:#ffffff;display:block;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;}
+:-moz-placeholder{color:#bfbfbf;}
+::-webkit-input-placeholder{color:#bfbfbf;}
+input,textarea{-webkit-transition:border linear 0.2s,box-shadow linear 0.2s;-moz-transition:border linear 0.2s,box-shadow linear 0.2s;-ms-transition:border linear 0.2s,box-shadow linear 0.2s;-o-transition:border linear 0.2s,box-shadow linear 0.2s;transition:border linear 0.2s,box-shadow linear 0.2s;-webkit-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1);}
+input:focus,textarea:focus{outline:0;border-color:rgba(82, 168, 236, 0.8);-webkit-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);-moz-box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.1),0 0 8px rgba(82, 168, 236, 0.6);}
+input[type=file]:focus,input[type=checkbox]:focus,select:focus{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;outline:1px dotted #666;}
+form .clearfix.error>label,form .clearfix.error .help-block,form .clearfix.error .help-inline{color:#b94a48;}
+form .clearfix.error input,form .clearfix.error textarea{color:#b94a48;border-color:#ee5f5b;}form .clearfix.error input:focus,form .clearfix.error textarea:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;}
+form .clearfix.error .input-prepend .add-on,form .clearfix.error .input-append .add-on{color:#b94a48;background-color:#fce6e6;border-color:#b94a48;}
+form .clearfix.warning>label,form .clearfix.warning .help-block,form .clearfix.warning .help-inline{color:#c09853;}
+form .clearfix.warning input,form .clearfix.warning textarea{color:#c09853;border-color:#ccae64;}form .clearfix.warning input:focus,form .clearfix.warning textarea:focus{border-color:#be9a3f;-webkit-box-shadow:0 0 6px #e5d6b1;-moz-box-shadow:0 0 6px #e5d6b1;box-shadow:0 0 6px #e5d6b1;}
+form .clearfix.warning .input-prepend .add-on,form .clearfix.warning .input-append .add-on{color:#c09853;background-color:#d2b877;border-color:#c09853;}
+form .clearfix.success>label,form .clearfix.success .help-block,form .clearfix.success .help-inline{color:#468847;}
+form .clearfix.success input,form .clearfix.success textarea{color:#468847;border-color:#57a957;}form .clearfix.success input:focus,form .clearfix.success textarea:focus{border-color:#458845;-webkit-box-shadow:0 0 6px #9acc9a;-moz-box-shadow:0 0 6px #9acc9a;box-shadow:0 0 6px #9acc9a;}
+form .clearfix.success .input-prepend .add-on,form .clearfix.success .input-append .add-on{color:#468847;background-color:#bcddbc;border-color:#468847;}
+.input-mini,input.mini,textarea.mini,select.mini{width:60px;}
+.input-small,input.small,textarea.small,select.small{width:90px;}
+.input-medium,input.medium,textarea.medium,select.medium{width:150px;}
+.input-large,input.large,textarea.large,select.large{width:210px;}
+.input-xlarge,input.xlarge,textarea.xlarge,select.xlarge{width:270px;}
+.input-xxlarge,input.xxlarge,textarea.xxlarge,select.xxlarge{width:530px;}
+textarea.xxlarge{overflow-y:auto;}
+input.span1,textarea.span1{display:inline-block;float:none;width:30px;margin-left:0;}
+input.span2,textarea.span2{display:inline-block;float:none;width:90px;margin-left:0;}
+input.span3,textarea.span3{display:inline-block;float:none;width:150px;margin-left:0;}
+input.span4,textarea.span4{display:inline-block;float:none;width:210px;margin-left:0;}
+input.span5,textarea.span5{display:inline-block;float:none;width:270px;margin-left:0;}
+input.span6,textarea.span6{display:inline-block;float:none;width:330px;margin-left:0;}
+input.span7,textarea.span7{display:inline-block;float:none;width:390px;margin-left:0;}
+input.span8,textarea.span8{display:inline-block;float:none;width:450px;margin-left:0;}
+input.span9,textarea.span9{display:inline-block;float:none;width:510px;margin-left:0;}
+input.span10,textarea.span10{display:inline-block;float:none;width:570px;margin-left:0;}
+input.span11,textarea.span11{display:inline-block;float:none;width:630px;margin-left:0;}
+input.span12,textarea.span12{display:inline-block;float:none;width:690px;margin-left:0;}
+input.span13,textarea.span13{display:inline-block;float:none;width:750px;margin-left:0;}
+input.span14,textarea.span14{display:inline-block;float:none;width:810px;margin-left:0;}
+input.span15,textarea.span15{display:inline-block;float:none;width:870px;margin-left:0;}
+input.span16,textarea.span16{display:inline-block;float:none;width:930px;margin-left:0;}
+input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{background-color:#f5f5f5;border-color:#ddd;cursor:not-allowed;}
+.actions{background:#f5f5f5;margin-top:18px;margin-bottom:18px;padding:17px 20px 18px 150px;border-top:1px solid #ddd;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}.actions .secondary-action{float:right;}.actions .secondary-action a{line-height:30px;}.actions .secondary-action a:hover{text-decoration:underline;}
+.help-inline,.help-block{font-size:13px;line-height:18px;color:#bfbfbf;}
+.help-inline{padding-left:5px;*position:relative;*top:-5px;}
+.help-block{display:block;max-width:600px;}
+.inline-inputs{color:#808080;}.inline-inputs span{padding:0 2px 0 1px;}
+.input-prepend input,.input-append input{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;}
+.input-prepend .add-on,.input-append .add-on{position:relative;background:#f5f5f5;border:1px solid #ccc;z-index:2;float:left;display:block;width:auto;min-width:16px;height:18px;padding:4px 4px 4px 5px;margin-right:-1px;font-weight:normal;line-height:18px;color:#bfbfbf;text-align:center;text-shadow:0 1px 0 #ffffff;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
+.input-prepend .active,.input-append .active{background:#a9dba9;border-color:#46a546;}
+.input-prepend .add-on{*margin-top:1px;}
+.input-append input{float:left;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
+.input-append .add-on{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;margin-right:0;margin-left:-1px;}
+.inputs-list{margin:0 0 5px;width:100%;}.inputs-list li{display:block;padding:0;width:100%;}
+.inputs-list label{display:block;float:none;width:auto;padding:0;margin-left:20px;line-height:18px;text-align:left;white-space:normal;}.inputs-list label strong{color:#808080;}
+.inputs-list label small{font-size:11px;font-weight:normal;}
+.inputs-list .inputs-list{margin-left:25px;margin-bottom:10px;padding-top:0;}
+.inputs-list:first-child{padding-top:6px;}
+.inputs-list li+li{padding-top:2px;}
+.inputs-list input[type=radio],.inputs-list input[type=checkbox]{margin-bottom:0;margin-left:-20px;float:left;}
+.form-stacked{padding-left:20px;}.form-stacked fieldset{padding-top:9px;}
+.form-stacked legend{padding-left:0;}
+.form-stacked label{display:block;float:none;width:auto;font-weight:bold;text-align:left;line-height:20px;padding-top:0;}
+.form-stacked .clearfix{margin-bottom:9px;}.form-stacked .clearfix div.input{margin-left:0;}
+.form-stacked .inputs-list{margin-bottom:0;}.form-stacked .inputs-list li{padding-top:0;}.form-stacked .inputs-list li label{font-weight:normal;padding-top:0;}
+.form-stacked div.clearfix.error{padding-top:10px;padding-bottom:10px;padding-left:10px;margin-top:0;margin-left:-10px;}
+.form-stacked .actions{margin-left:-20px;padding-left:20px;}
+table{width:100%;margin-bottom:18px;padding:0;font-size:13px;border-collapse:collapse;}table th,table td{padding:10px 10px 9px;line-height:18px;text-align:left;}
+table th{padding-top:9px;font-weight:bold;vertical-align:middle;}
+table td{vertical-align:top;border-top:1px solid #ddd;}
+table tbody th{border-top:1px solid #ddd;vertical-align:top;}
+.condensed-table th,.condensed-table td{padding:5px 5px 4px;}
+.bordered-table{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.bordered-table th+th,.bordered-table td+td,.bordered-table th+td{border-left:1px solid #ddd;}
+.bordered-table thead tr:first-child th:first-child,.bordered-table tbody tr:first-child td:first-child{-webkit-border-radius:4px 0 0 0;-moz-border-radius:4px 0 0 0;border-radius:4px 0 0 0;}
+.bordered-table thead tr:first-child th:last-child,.bordered-table tbody tr:first-child td:last-child{-webkit-border-radius:0 4px 0 0;-moz-border-radius:0 4px 0 0;border-radius:0 4px 0 0;}
+.bordered-table tbody tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;}
+.bordered-table tbody tr:last-child td:last-child{-webkit-border-radius:0 0 4px 0;-moz-border-radius:0 0 4px 0;border-radius:0 0 4px 0;}
+table .span1{width:20px;}
+table .span2{width:60px;}
+table .span3{width:100px;}
+table .span4{width:140px;}
+table .span5{width:180px;}
+table .span6{width:220px;}
+table .span7{width:260px;}
+table .span8{width:300px;}
+table .span9{width:340px;}
+table .span10{width:380px;}
+table .span11{width:420px;}
+table .span12{width:460px;}
+table .span13{width:500px;}
+table .span14{width:540px;}
+table .span15{width:580px;}
+table .span16{width:620px;}
+.zebra-striped tbody tr:nth-child(odd) td,.zebra-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9;}
+.zebra-striped tbody tr:hover td,.zebra-striped tbody tr:hover th{background-color:#f5f5f5;}
+table .header{cursor:pointer;}table .header:after{content:"";float:right;margin-top:7px;border-width:0 4px 4px;border-style:solid;border-color:#000 transparent;visibility:hidden;}
+table .headerSortUp,table .headerSortDown{background-color:rgba(141, 192, 219, 0.25);text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);}
+table .header:hover:after{visibility:visible;}
+table .headerSortDown:after,table .headerSortDown:hover:after{visibility:visible;filter:alpha(opacity=60);-khtml-opacity:0.6;-moz-opacity:0.6;opacity:0.6;}
+table .headerSortUp:after{border-bottom:none;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000;visibility:visible;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:alpha(opacity=60);-khtml-opacity:0.6;-moz-opacity:0.6;opacity:0.6;}
+table .blue{color:#049cdb;border-bottom-color:#049cdb;}
+table .headerSortUp.blue,table .headerSortDown.blue{background-color:#ade6fe;}
+table .green{color:#46a546;border-bottom-color:#46a546;}
+table .headerSortUp.green,table .headerSortDown.green{background-color:#cdeacd;}
+table .red{color:#9d261d;border-bottom-color:#9d261d;}
+table .headerSortUp.red,table .headerSortDown.red{background-color:#f4c8c5;}
+table .yellow{color:#ffc40d;border-bottom-color:#ffc40d;}
+table .headerSortUp.yellow,table .headerSortDown.yellow{background-color:#fff6d9;}
+table .orange{color:#f89406;border-bottom-color:#f89406;}
+table .headerSortUp.orange,table .headerSortDown.orange{background-color:#fee9cc;}
+table .purple{color:#7a43b6;border-bottom-color:#7a43b6;}
+table .headerSortUp.purple,table .headerSortDown.purple{background-color:#e2d5f0;}
+.topbar{height:40px;position:fixed;top:0;left:0;right:0;z-index:10000;overflow:visible;}.topbar a{color:#bfbfbf;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);}
+.topbar h3 a:hover,.topbar .brand:hover,.topbar ul .active>a{background-color:#333;background-color:rgba(255, 255, 255, 0.05);color:#ffffff;text-decoration:none;}
+.topbar h3{position:relative;}
+.topbar h3 a,.topbar .brand{float:left;display:block;padding:8px 20px 12px;margin-left:-20px;color:#ffffff;font-size:20px;font-weight:200;line-height:1;}
+.topbar p{margin:0;line-height:40px;}.topbar p a:hover{background-color:transparent;color:#ffffff;}
+.topbar form{float:left;margin:5px 0 0 0;position:relative;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1;}
+.topbar form.pull-right{float:right;}
+.topbar input{background-color:#444;background-color:rgba(255, 255, 255, 0.3);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:normal;font-weight:13px;line-height:1;padding:4px 9px;color:#ffffff;color:rgba(255, 255, 255, 0.75);border:1px solid #111;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.25);-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;}.topbar input:-moz-placeholder{color:#e6e6e6;}
+.topbar input::-webkit-input-placeholder{color:#e6e6e6;}
+.topbar input:hover{background-color:#bfbfbf;background-color:rgba(255, 255, 255, 0.5);color:#ffffff;}
+.topbar input:focus,.topbar input.focused{outline:0;background-color:#ffffff;color:#404040;text-shadow:0 1px 0 #ffffff;border:0;padding:5px 10px;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);}
+.topbar-inner,.topbar .fill{background-color:#222;background-color:#222222;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);}
+.topbar div>ul,.nav{display:block;float:left;margin:0 10px 0 0;position:relative;left:0;}.topbar div>ul>li,.nav>li{display:block;float:left;}
+.topbar div>ul a,.nav a{display:block;float:none;padding:10px 10px 11px;line-height:19px;text-decoration:none;}.topbar div>ul a:hover,.nav a:hover{color:#ffffff;text-decoration:none;}
+.topbar div>ul .active>a,.nav .active>a{background-color:#222;background-color:rgba(0, 0, 0, 0.5);}
+.topbar div>ul.secondary-nav,.nav.secondary-nav{float:right;margin-left:10px;margin-right:0;}.topbar div>ul.secondary-nav .menu-dropdown,.nav.secondary-nav .menu-dropdown,.topbar div>ul.secondary-nav .dropdown-menu,.nav.secondary-nav .dropdown-menu{right:0;border:0;}
+.topbar div>ul a.menu:hover,.nav a.menu:hover,.topbar div>ul li.open .menu,.nav li.open .menu,.topbar div>ul .dropdown-toggle:hover,.nav .dropdown-toggle:hover,.topbar div>ul .dropdown.open .dropdown-toggle,.nav .dropdown.open .dropdown-toggle{background:#444;background:rgba(255, 255, 255, 0.05);}
+.topbar div>ul .menu-dropdown,.nav .menu-dropdown,.topbar div>ul .dropdown-menu,.nav .dropdown-menu{background-color:#333;}.topbar div>ul .menu-dropdown a.menu,.nav .menu-dropdown a.menu,.topbar div>ul .dropdown-menu a.menu,.nav .dropdown-menu a.menu,.topbar div>ul .menu-dropdown .dropdown-toggle,.nav .menu-dropdown .dropdown-toggle,.topbar div>ul .dropdown-menu .dropdown-toggle,.nav .dropdown-menu .dropdown-toggle{color:#ffffff;}.topbar div>ul .menu-dropdown a.menu.open,.nav .menu-dropdown a.menu.open,.topbar div>ul .dropdown-menu a.menu.open,.nav .dropdown-menu a.menu.open,.topbar div>ul .menu-dropdown .dropdown-toggle.open,.nav .menu-dropdown .dropdown-toggle.open,.topbar div>ul .dropdown-menu .dropdown-toggle.open,.nav .dropdown-menu .dropdown-toggle.open{background:#444;background:rgba(255, 255, 255, 0.05);}
+.topbar div>ul .menu-dropdown li a,.nav .menu-dropdown li a,.topbar div>ul .dropdown-menu li a,.nav .dropdown-menu li a{color:#999;text-shadow:0 1px 0 rgba(0, 0, 0, 0.5);}.topbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.topbar div>ul .dropdown-menu li a:hover,.nav .dropdown-menu li a:hover{background-color:#191919;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919));background-image:-moz-linear-gradient(top, #292929, #191919);background-image:-ms-linear-gradient(top, #292929, #191919);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919));background-image:-webkit-linear-gradient(top, #292929, #191919);background-image:-o-linear-gradient(top, #292929, #191919);background-image:linear-gradient(top, #292929, #191919);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0);color:#ffffff;}
+.topbar div>ul .menu-dropdown .active a,.nav .menu-dropdown .active a,.topbar div>ul .dropdown-menu .active a,.nav .dropdown-menu .active a{color:#ffffff;}
+.topbar div>ul .menu-dropdown .divider,.nav .menu-dropdown .divider,.topbar div>ul .dropdown-menu .divider,.nav .dropdown-menu .divider{background-color:#222;border-color:#444;}
+.topbar ul .menu-dropdown li a,.topbar ul .dropdown-menu li a{padding:4px 15px;}
+li.menu,.dropdown{position:relative;}
+a.menu:after,.dropdown-toggle:after{width:0;height:0;display:inline-block;content:"&darr;";text-indent:-99999px;vertical-align:top;margin-top:8px;margin-left:4px;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #ffffff;filter:alpha(opacity=50);-khtml-opacity:0.5;-moz-opacity:0.5;opacity:0.5;}
+.menu-dropdown,.dropdown-menu{background-color:#ffffff;float:left;display:none;position:absolute;top:40px;z-index:900;min-width:160px;max-width:220px;_width:160px;margin-left:0;margin-right:0;padding:6px 0;zoom:1;border-color:#999;border-color:rgba(0, 0, 0, 0.2);border-style:solid;border-width:0 1px 1px;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);box-shadow:0 2px 4px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.menu-dropdown li,.dropdown-menu li{float:none;display:block;background-color:none;}
+.menu-dropdown .divider,.dropdown-menu .divider{height:1px;margin:5px 0;overflow:hidden;background-color:#eee;border-bottom:1px solid #ffffff;}
+.topbar .dropdown-menu a,.dropdown-menu a{display:block;padding:4px 15px;clear:both;font-weight:normal;line-height:18px;color:#808080;text-shadow:0 1px 0 #ffffff;}.topbar .dropdown-menu a:hover,.dropdown-menu a:hover,.topbar .dropdown-menu a.hover,.dropdown-menu a.hover{background-color:#dddddd;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#eeeeee), to(#dddddd));background-image:-moz-linear-gradient(top, #eeeeee, #dddddd);background-image:-ms-linear-gradient(top, #eeeeee, #dddddd);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #dddddd));background-image:-webkit-linear-gradient(top, #eeeeee, #dddddd);background-image:-o-linear-gradient(top, #eeeeee, #dddddd);background-image:linear-gradient(top, #eeeeee, #dddddd);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0);color:#404040;text-decoration:none;-webkit-box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 0 rgba(0, 0, 0, 0.025),inset 0 -1px rgba(0, 0, 0, 0.025);}
+.open .menu,.dropdown.open .menu,.open .dropdown-toggle,.dropdown.open .dropdown-toggle{color:#ffffff;background:#ccc;background:rgba(0, 0, 0, 0.3);}
+.open .menu-dropdown,.dropdown.open .menu-dropdown,.open .dropdown-menu,.dropdown.open .dropdown-menu{display:block;}
+.tabs,.pills{margin:0 0 18px;padding:0;list-style:none;zoom:1;}.tabs:before,.pills:before,.tabs:after,.pills:after{display:table;content:"";zoom:1;}
+.tabs:after,.pills:after{clear:both;}
+.tabs>li,.pills>li{float:left;}.tabs>li>a,.pills>li>a{display:block;}
+.tabs{border-color:#ddd;border-style:solid;border-width:0 0 1px;}.tabs>li{position:relative;margin-bottom:-1px;}.tabs>li>a{padding:0 15px;margin-right:2px;line-height:34px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.tabs>li>a:hover{text-decoration:none;background-color:#eee;border-color:#eee #eee #ddd;}
+.tabs .active>a,.tabs .active>a:hover{color:#808080;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;}
+.tabs .menu-dropdown,.tabs .dropdown-menu{top:35px;border-width:1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;}
+.tabs a.menu:after,.tabs .dropdown-toggle:after{border-top-color:#999;margin-top:15px;margin-left:5px;}
+.tabs li.open.menu .menu,.tabs .open.dropdown .dropdown-toggle{border-color:#999;}
+.tabs li.open a.menu:after,.tabs .dropdown.open .dropdown-toggle:after{border-top-color:#555;}
+.pills a{margin:5px 3px 5px 0;padding:0 15px;line-height:30px;text-shadow:0 1px 1px #ffffff;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;}.pills a:hover{color:#ffffff;text-decoration:none;text-shadow:0 1px 1px rgba(0, 0, 0, 0.25);background-color:#00438a;}
+.pills .active a{color:#ffffff;text-shadow:0 1px 1px rgba(0, 0, 0, 0.25);background-color:#0069d6;}
+.pills-vertical>li{float:none;}
+.tab-content>.tab-pane,.pill-content>.pill-pane,.tab-content>div,.pill-content>div{display:none;}
+.tab-content>.active,.pill-content>.active{display:block;}
+.breadcrumb{padding:7px 14px;margin:0 0 18px;background-color:#f5f5f5;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#ffffff), to(#f5f5f5));background-image:-moz-linear-gradient(top, #ffffff, #f5f5f5);background-image:-ms-linear-gradient(top, #ffffff, #f5f5f5);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f5f5f5));background-image:-webkit-linear-gradient(top, #ffffff, #f5f5f5);background-image:-o-linear-gradient(top, #ffffff, #f5f5f5);background-image:linear-gradient(top, #ffffff, #f5f5f5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0);border:1px solid #ddd;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;}.breadcrumb li{display:inline;text-shadow:0 1px 0 #ffffff;}
+.breadcrumb .divider{padding:0 5px;color:#bfbfbf;}
+.breadcrumb .active a{color:#404040;}
+.hero-unit{background-color:#f5f5f5;margin-bottom:30px;padding:60px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;}
+.hero-unit p{font-size:18px;font-weight:200;line-height:27px;}
+footer{margin-top:17px;padding-top:17px;border-top:1px solid #eee;}
+.page-header{margin-bottom:17px;border-bottom:1px solid #ddd;-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);box-shadow:0 1px 0 rgba(255, 255, 255, 0.5);}.page-header h1{margin-bottom:8px;}
+.btn.danger,.alert-message.danger,.btn.danger:hover,.alert-message.danger:hover,.btn.error,.alert-message.error,.btn.error:hover,.alert-message.error:hover,.btn.success,.alert-message.success,.btn.success:hover,.alert-message.success:hover,.btn.info,.alert-message.info,.btn.info:hover,.alert-message.info:hover{color:#ffffff;}
+.btn .close,.alert-message .close{font-family:Arial,sans-serif;line-height:18px;}
+.btn.danger,.alert-message.danger,.btn.error,.alert-message.error{background-color:#c43c35;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-ms-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(top, #ee5f5b, #c43c35);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#c43c35 #c43c35 #882a25;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn.success,.alert-message.success{background-color:#57a957;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957));background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-ms-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(top, #62c462, #57a957);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#57a957 #57a957 #3d773d;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn.info,.alert-message.info{background-color:#339bb9;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9));background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-ms-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(top, #5bc0de, #339bb9);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#339bb9 #339bb9 #22697d;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn{cursor:pointer;display:inline-block;background-color:#e6e6e6;background-repeat:no-repeat;background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:-moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);background-image:-ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:-o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);background-image:linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);padding:5px 14px 6px;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);color:#333;font-size:13px;line-height:normal;border:1px solid #ccc;border-bottom-color:#bbb;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-webkit-transition:0.1s linear all;-moz-transition:0.1s linear all;-ms-transition:0.1s linear all;-o-transition:0.1s linear all;transition:0.1s linear all;}.btn:hover{background-position:0 -15px;color:#333;text-decoration:none;}
+.btn:focus{outline:1px dotted #666;}
+.btn.primary{color:#ffffff;background-color:#0064cd;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd));background-image:-moz-linear-gradient(top, #049cdb, #0064cd);background-image:-ms-linear-gradient(top, #049cdb, #0064cd);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd));background-image:-webkit-linear-gradient(top, #049cdb, #0064cd);background-image:-o-linear-gradient(top, #049cdb, #0064cd);background-image:linear-gradient(top, #049cdb, #0064cd);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#0064cd #0064cd #003f81;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);}
+.btn.active,.btn:active{-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.25),0 1px 2px rgba(0, 0, 0, 0.05);}
+.btn.disabled{cursor:default;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=65);-khtml-opacity:0.65;-moz-opacity:0.65;opacity:0.65;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
+.btn[disabled]{cursor:default;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=65);-khtml-opacity:0.65;-moz-opacity:0.65;opacity:0.65;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
+.btn.large{font-size:15px;line-height:normal;padding:9px 14px 9px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}
+.btn.small{padding:7px 9px 7px;font-size:11px;}
+:root .alert-message,:root .btn{border-radius:0 \0;}
+button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0;}
+.close{float:right;color:#000000;font-size:20px;font-weight:bold;line-height:13.5px;text-shadow:0 1px 0 #ffffff;filter:alpha(opacity=25);-khtml-opacity:0.25;-moz-opacity:0.25;opacity:0.25;}.close:hover{color:#000000;text-decoration:none;filter:alpha(opacity=40);-khtml-opacity:0.4;-moz-opacity:0.4;opacity:0.4;}
+.alert-message{position:relative;padding:7px 15px;margin-bottom:18px;color:#404040;background-color:#eedc94;background-repeat:repeat-x;background-image:-khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94));background-image:-moz-linear-gradient(top, #fceec1, #eedc94);background-image:-ms-linear-gradient(top, #fceec1, #eedc94);background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94));background-image:-webkit-linear-gradient(top, #fceec1, #eedc94);background-image:-o-linear-gradient(top, #fceec1, #eedc94);background-image:linear-gradient(top, #fceec1, #eedc94);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0);text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);border-color:#eedc94 #eedc94 #e4c652;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);border-width:1px;border-style:solid;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.25);}.alert-message .close{margin-top:1px;*margin-top:0;}
+.alert-message a{font-weight:bold;color:#404040;}
+.alert-message.danger p a,.alert-message.error p a,.alert-message.success p a,.alert-message.info p a{color:#ffffff;}
+.alert-message h5{line-height:18px;}
+.alert-message p{margin-bottom:0;}
+.alert-message div{margin-top:5px;margin-bottom:2px;line-height:28px;}
+.alert-message .btn{-webkit-box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);-moz-box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);box-shadow:0 1px 0 rgba(255, 255, 255, 0.25);}
+.alert-message.block-message{background-image:none;background-color:#fdf5d9;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);padding:14px;border-color:#fceec1;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}.alert-message.block-message ul,.alert-message.block-message p{margin-right:30px;}
+.alert-message.block-message ul{margin-bottom:0;}
+.alert-message.block-message li{color:#404040;}
+.alert-message.block-message .alert-actions{margin-top:5px;}
+.alert-message.block-message.error,.alert-message.block-message.success,.alert-message.block-message.info{color:#404040;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);}
+.alert-message.block-message.error{background-color:#fddfde;border-color:#fbc7c6;}
+.alert-message.block-message.success{background-color:#d1eed1;border-color:#bfe7bf;}
+.alert-message.block-message.info{background-color:#ddf4fb;border-color:#c6edf9;}
+.alert-message.block-message.danger p a,.alert-message.block-message.error p a,.alert-message.block-message.success p a,.alert-message.block-message.info p a{color:#404040;}
+.pagination{height:36px;margin:18px 0;}.pagination ul{float:left;margin:0;border:1px solid #ddd;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);}
+.pagination li{display:inline;}
+.pagination a{float:left;padding:0 14px;line-height:34px;border-right:1px solid;border-right-color:#ddd;border-right-color:rgba(0, 0, 0, 0.15);*border-right-color:#ddd;text-decoration:none;}
+.pagination a:hover,.pagination .active a{background-color:#c7eefe;}
+.pagination .disabled a,.pagination .disabled a:hover{background-color:transparent;color:#bfbfbf;}
+.pagination .next a{border:0;}
+.well{background-color:#f5f5f5;margin-bottom:20px;padding:19px;min-height:20px;border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);}
+.modal-backdrop{background-color:#000000;position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;}.modal-backdrop.fade{opacity:0;}
+.modal-backdrop,.modal-backdrop.fade.in{filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}
+.modal{position:fixed;top:50%;left:50%;z-index:11000;max-height:500px;overflow:auto;width:560px;margin:-250px 0 0 -280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.modal .close{margin-top:7px;}
+.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-ms-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;}
+.modal.fade.in{top:50%;}
+.modal-header{border-bottom:1px solid #eee;padding:5px 15px;}
+.modal-body{padding:15px;}
+.modal-body form{margin-bottom:0;}
+.modal-footer{background-color:#f5f5f5;padding:14px 15px 15px;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;zoom:1;margin-bottom:0;}.modal-footer:before,.modal-footer:after{display:table;content:"";zoom:1;}
+.modal-footer:after{clear:both;}
+.modal-footer .btn{float:right;margin-left:5px;}
+.modal .popover,.modal .twipsy{z-index:12000;}
+.twipsy{display:block;position:absolute;visibility:visible;padding:5px;font-size:11px;z-index:1000;filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}.twipsy.fade.in{filter:alpha(opacity=80);-khtml-opacity:0.8;-moz-opacity:0.8;opacity:0.8;}
+.twipsy.above .twipsy-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
+.twipsy.left .twipsy-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
+.twipsy.below .twipsy-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
+.twipsy.right .twipsy-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
+.twipsy-inner{padding:3px 8px;background-color:#000000;color:white;text-align:center;max-width:200px;text-decoration:none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
+.twipsy-arrow{position:absolute;width:0;height:0;}
+.popover{position:absolute;top:0;left:0;z-index:1000;padding:5px;display:none;}.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
+.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
+.popover.below .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
+.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
+.popover .arrow{position:absolute;width:0;height:0;}
+.popover .inner{background:#000000;background:rgba(0, 0, 0, 0.8);padding:3px;overflow:hidden;width:280px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);}
+.popover .title{background-color:#f5f5f5;padding:9px 15px;line-height:1;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;border-bottom:1px solid #eee;}
+.popover .content{background-color:#ffffff;padding:14px;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.popover .content p,.popover .content ul,.popover .content ol{margin-bottom:0;}
+.fade{-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-ms-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;opacity:0;}.fade.in{opacity:1;}
+.label{padding:1px 3px 2px;font-size:9.75px;font-weight:bold;color:#ffffff;text-transform:uppercase;white-space:nowrap;background-color:#bfbfbf;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;text-shadow:none;}.label.important{background-color:#c43c35;}
+.label.warning{background-color:#f89406;}
+.label.success{background-color:#46a546;}
+.label.notice{background-color:#62cffc;}
+.media-grid{margin-left:-20px;margin-bottom:0;zoom:1;}.media-grid:before,.media-grid:after{display:table;content:"";zoom:1;}
+.media-grid:after{clear:both;}
+.media-grid li{display:inline;}
+.media-grid a{float:left;padding:4px;margin:0 0 18px 20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);}.media-grid a img{display:block;}
+.media-grid a:hover{border-color:#0069d6;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);}
diff --git a/rpkid/portal-gui/media/img/my.png b/rpkid/portal-gui/media/img/my.png
deleted file mode 100644
index c4d1378e..00000000
--- a/rpkid/portal-gui/media/img/my.png
+++ /dev/null
Binary files differ
diff --git a/rpkid/portal-gui/media/img/rpki.png b/rpkid/portal-gui/media/img/rpki.png
deleted file mode 100644
index 31351980..00000000
--- a/rpkid/portal-gui/media/img/rpki.png
+++ /dev/null
Binary files differ
diff --git a/rpkid/portal-gui/rpki.wsgi.in b/rpkid/portal-gui/rpki.wsgi.in
new file mode 100644
index 00000000..eb49fe05
--- /dev/null
+++ b/rpkid/portal-gui/rpki.wsgi.in
@@ -0,0 +1,54 @@
+# Copyright (C) 2010, 2011 SPARTA, Inc. dba Cobham Analytic Solutions
+# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
+#
+# 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.
+
+# This is an example wsgi application for use with mod_wsgi and apache.
+
+__version__ = '$Id$'
+
+VIRTUAL_ENV = '@VIRTUAL_ENV@'
+
+import os
+import os.path
+import sys
+
+old_sys_path = list(sys.path)
+
+# When used with virtualenv, specify the location of the python modules to use
+if VIRTUAL_ENV:
+ import site
+ # locate the site-packages directory
+ for (dp, dn, fn) in os.walk(VIRTUAL_ENV + '/lib'):
+ if 'site-packages' in dn:
+ site.addsitedir(os.path.join(dp, 'site-packages'))
+ break
+
+import sys
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
+sys.path.insert(1, '@PYTHONPATH@')
+
+# reorder sys.path to place newly added directories at the head of the path.
+# this is necessary so that the packages in the virtualenv site-packages are
+# used rather than the system site-packages.
+new_sys_path = []
+for elt in list(sys.path):
+ if elt not in old_sys_path:
+ new_sys_path.append(elt)
+ sys.path.remove(elt)
+sys.path[:0] = new_sys_path
+
+import django.core.handlers.wsgi
+application = django.core.handlers.wsgi.WSGIHandler()
+
+# vim:ft=python
diff --git a/rpkid/portal-gui/scripts/adduser.py b/rpkid/portal-gui/scripts/adduser.py
deleted file mode 100644
index b06c6bc4..00000000
--- a/rpkid/portal-gui/scripts/adduser.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# $Id$
-#
-# Copyright (C) 2010, 2011 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 quickly set up a new portal-gui user/handle. This script
-# is designed to be safe to run multiple times for the same user.
-#
-# DO NOT EDIT! This script is automatically generated from adduser.py
-
-from django.contrib.auth.models import User
-from rpki.gui.app import settings
-from rpki.gui.app.models import Conf
-
-import getpass
-import pwd
-
-# The username that apache runs as. This is required so that we can chown
-# the csv files that the portal-gui needs to write.
-web_uid = pwd.getpwnam(settings.WEB_USER)[2]
-
-if __name__ == '__main__':
- if len(sys.argv) < 3:
- print >>sys.stderr, 'usage: adduser <username> <user\'s email> <host handle>'
- sys.exit(1)
-
- if os.getuid() != 0:
- print >>sys.stderr, 'error: this script must be run as root so it can set file permissions.'
- sys.exit(1)
-
- username = sys.argv[1]
- email = sys.argv[2]
- host = sys.argv[3]
- print 'username=', username, 'email=', email, 'host=', host
-
- user_set = User.objects.filter(username=username)
- if user_set:
- print >>sys.stderr, 'user already exists'
- user = user_set[0]
- else:
- print >>sys.stderr, 'creating user'
- password = getpass.getpass()
- user = User.objects.create_user(username, email, password)
-
- conf_set = Conf.objects.filter(handle=username)
- if conf_set:
- conf = conf_set[0]
- else:
- print >>sys.stderr, 'creating conf'
- conf = Conf.objects.create(handle=username)
-
- # always try to add the user as owner just in case the Conf object was
- # created previously by the "list_resources" script
- conf.owner.add(user)
-
- if host != username:
- host_set = Conf.objects.filter(handle=host)
- if not host_set:
- print >>sys.stderr, 'error: Conf object for host %s does not exist!' % host
- sys.exit(1)
-
- conf.host = host_set[0]
- else:
- print >>sys.stderr, '%s is self-hosted' % username
- conf.save()
-
- myrpki_dir = '%s/%s' % (settings.CONFDIR, username)
- print 'myrpki_dir=', myrpki_dir
- if not os.path.exists(myrpki_dir):
- print 'creating ', myrpki_dir
- os.mkdir(myrpki_dir)
- os.chown(myrpki_dir, web_uid, -1)
-
-# vim:sw=4 ts=8
diff --git a/rpkid/portal-gui/scripts/dumpdata.py b/rpkid/portal-gui/scripts/dumpdata.py
new file mode 100755
index 00000000..dcf23666
--- /dev/null
+++ b/rpkid/portal-gui/scripts/dumpdata.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# $Id$
+#
+# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
+#
+# 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.
+#
+# This is a helper script which will dump the rpki.gui.app models from
+# the old sqlite3 database, forcing the output order to the primary key in
+# order to avoid forward references for the AddressRange table.
+
+from django.conf import settings
+settings.configure(DEBUG=True,
+ DATABASES={
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': '/usr/local/var/rpki/gui.db',
+ }
+ })
+
+from django.core import serializers
+import django.db.models
+
+from rpki.gui.app import models
+from django.contrib.auth import models as auth_models
+
+data = []
+for v in (auth_models.User, models.Conf, models.Parent, models.Child, models.AddressRange, models.Asn, models.ResourceCert, models.Roa, models.RoaRequest, models.Ghostbuster):
+ data.extend(list(v.objects.all().order_by('id')))
+
+print serializers.serialize('json', data, use_natural_keys=True)
+
+# vim:sw=4 ts=8 expandtab
diff --git a/rpkid/portal-gui/scripts/list_resources.py b/rpkid/portal-gui/scripts/list_resources.py
deleted file mode 100644
index 13864705..00000000
--- a/rpkid/portal-gui/scripts/list_resources.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# $Id$
-#
-# Copyright (C) 2010, 2011 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.
-#
-#
-# This script is reponsible for talking to rpkid and populating the
-# portal-gui's sqlite database. It asks rpkid for the list of received
-# resources, and the handles of any children.
-#
-# This script should be run in the directory containing the rpki.conf
-# for the handle that is self-hosting rpkid.
-#
-# Exit values:
-# 0 success, no errors
-# 1 fatal error
-# 2 usage error
-# 3 did not receive all <list_received_resources/> responses, try again
-# later
-
-import sys
-
-import os
-os.environ['DJANGO_SETTINGS_MODULE'] = 'rpki.gui.settings'
-
-import getopt
-from datetime import datetime, timedelta
-from os.path import basename
-
-import rpki.config, rpki.left_right, rpki.resource_set
-from rpki.gui.app import models, glue
-
-verbose = False
-version = '$Id$'
-
-def query_rpkid():
- """
- Fetch our received resources from the local rpkid using the rpki.conf
- in the current directory.
- """
- cfg = rpki.config.parser(section='myrpki')
- call_rpkid = glue.build_rpkid_caller(cfg, verbose)
-
- if verbose:
- print 'retrieving the list of <self/> handles served by this rpkid'
- rpkid_reply = call_rpkid(rpki.left_right.self_elt.make_pdu(action="list"))
-
- # retrieve info about each handle
- pdus = []
- handles = []
- for h in rpkid_reply:
- assert isinstance(h, rpki.left_right.self_elt)
- if verbose:
- print 'adding handle %s to query' % (h.self_handle,)
- # keep a list of the handles served by rpkid so that we may check that
- # all expected responses are received.
- handles.append(h.self_handle)
- pdus.extend(
- [rpki.left_right.child_elt.make_pdu(action="list", self_handle=h.self_handle),
- rpki.left_right.list_received_resources_elt.make_pdu(self_handle=h.self_handle)
- #rpki.left_right.parent_elt.make_pdu(action="list", tag="parents", self_handle=handle),
- #rpki.left_right.list_roa_requests_elt.make_pdu(tag='roas', self_handle=handle),
- ])
-
- if verbose:
- print 'querying for children and resources'
- return handles, call_rpkid(*pdus)
-
-def usage(rc):
- print 'usage: %s [ -hvV ] [ --help ] [ --verbose ] [ --version ]' % basename(sys.argv[0],)
- sys.exit(rc)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], 'hvV', [ 'help', 'verbose', 'version'])
-except getopt.GetoptError, err:
- print str(err)
- usage(2)
-
-for o,a in opts:
- if o in ('-h', '--help'):
- usage(0)
- elif o in ('-v', '--verbose'):
- verbose = True
- elif o in ('-V', '--version'):
- print basename(sys.argv[0]), version
- sys.exit(0)
-
-handles, pdus = query_rpkid()
-seen = set() # which handles we got <list_received_resources/> responses
-for pdu in pdus:
- conf_set = models.Conf.objects.filter(handle=pdu.self_handle)
- if conf_set.count():
- conf = conf_set[0]
- else:
- if verbose:
- print 'creating new conf for %s' % (pdu.self_handle,)
- conf = models.Conf.objects.create(handle=pdu.self_handle)
-
- #if isinstance(pdu, rpki.left_right.parent_elt):
-# print x.parent_handle, x.sia_base, x.sender_name, x.recipient_name, \
-# x.peer_contact_uri
- if isinstance(pdu, rpki.left_right.child_elt):
- # have we seen this child before?
- child_set = conf.children.filter(handle=pdu.child_handle)
- if not child_set:
- if verbose:
- print 'creating new child %s' % (pdu.child_handle,)
- # default to 1 year. no easy way to query irdb for the
- # current value.
- valid_until = datetime.now() + timedelta(days=365)
- child = models.Child(conf=conf, handle=pdu.child_handle,
- valid_until=valid_until)
- child.save()
- #elif isinstance(x, rpki.left_right.list_roa_requests_elt):
- # print x.asn, x.ipv4, x.ipv6
- elif isinstance(pdu, rpki.left_right.list_received_resources_elt):
- # keep track of handles we got replies for
- seen.add(pdu.self_handle)
- # have we seen this parent before?
- parent_set = conf.parents.filter(handle=pdu.parent_handle)
- if not parent_set:
- if verbose:
- print 'creating new parent %s' % (pdu.parent_handle,)
- parent = models.Parent(conf=conf, handle=pdu.parent_handle)
- parent.save()
- else:
- parent = parent_set[0]
-
- not_before = datetime.strptime(pdu.notBefore, "%Y-%m-%dT%H:%M:%SZ")
- not_after = datetime.strptime(pdu.notAfter, "%Y-%m-%dT%H:%M:%SZ")
-
- # have we seen this resource cert before?
- cert_set = parent.resources.filter(uri=pdu.uri)
- if cert_set.count() == 0:
- cert = models.ResourceCert(uri=pdu.uri, parent=parent,
- not_before=not_before, not_after=not_after)
- else:
- cert = cert_set[0]
- # update timestamps since it could have been modified
- cert.not_before = not_before
- cert.not_after = not_after
- cert.save()
-
- for asn in rpki.resource_set.resource_set_as(pdu.asn):
- # see if this resource is already part of the cert
- if cert.asn.filter(lo=asn.min, hi=asn.max).count() == 0:
- # ensure this range wasn't seen from another of our parents
- for v in models.Asn.objects.filter(lo=asn.min, hi=asn.max):
- # determine if resource is delegated from another parent
- if v.from_cert.filter(parent__in=conf.parents.all()).count():
- cert.asn.add(v)
- break
- else:
- if verbose:
- print 'adding AS %s' % (asn,)
- cert.asn.create(lo=asn.min, hi=asn.max)
- cert.save()
-
- # IPv4/6 - not separated in the django db
- def add_missing_address(addr_set):
- for ip in addr_set:
- lo=str(ip.min)
- hi=str(ip.max)
- if cert.address_range.filter(lo=lo, hi=hi).count() == 0:
- # ensure that this range wasn't previously seen from another of our parents
- for v in models.AddressRange.objects.filter(lo=lo, hi=hi):
- # determine if this resource is delegated from another parent as well
- if v.from_cert.filter(parent__in=conf.parents.all()).count():
- cert.address_range.add(v)
- break
- else:
- if verbose:
- print 'adding address range %s' % (ip,)
- cert.address_range.create(lo=lo, hi=hi)
- cert.save()
-
- add_missing_address(rpki.resource_set.resource_set_ipv4(pdu.ipv4))
- add_missing_address(rpki.resource_set.resource_set_ipv6(pdu.ipv6))
-
-# verify that we got responses for all expected handles
-for h in handles:
- if h not in seen:
- if verbose:
- print 'warning: did not receive response for handle %s' % (h,)
- sys.exit(3)
-
-sys.exit(0) # success
-
-# vim:sw=4 expandtab ts=4
diff --git a/rpkid/portal-gui/scripts/load_csv.py b/rpkid/portal-gui/scripts/load_csv.py
deleted file mode 100755
index 9d4fc1ac..00000000
--- a/rpkid/portal-gui/scripts/load_csv.py
+++ /dev/null
@@ -1,143 +0,0 @@
-# $Id$
-#
-# Copyright (C) 2010, 2011 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 load existing data from csv into the Django DB.
-# Primarly useful for the initial load, as the GUI does not sync changes
-# made directly to the csv files back into the database.
-#
-# This script should be run from the directory containing the rpki.conf
-# for the handle you are loading data
-#
-
-import csv
-import socket # for socket.error
-
-import rpki.resource_set, rpki.ipaddrs
-from rpki.myrpki import csv_reader
-from rpki.gui.app import models
-from rpki.gui.app.views import add_roa_requests
-
-cfg = rpki.config.parser(section='myrpki')
-handle = cfg.get('handle')
-asn_csv = cfg.get('asn_csv')
-prefix_csv = cfg.get('prefix_csv')
-roa_csv = cfg.get('roa_csv')
-
-print 'processing csv files for resource handle', handle
-
-conf = models.Conf.objects.get(handle=handle)
-
-class RangeError(Exception):
- """
- Problem with ASN range or address range.
- """
-
-# every parent has a favorite
-def best_child(address_range, parent, parent_range):
- '''Return the child address range that is the closest match, or
- returns the arguments if no children.'''
- if address_range == parent_range:
- return (parent, parent_range)
- for q in list(parent.children.all()): # force strict evaluation
- t = q.as_resource_range()
- if t.min <= address_range.min and t.max >= address_range.max:
- return best_child(address_range, q, t)
- # check for overlap
- if t.min <= address_range.min <= t.max or t.min <= address_range.max <= t.max:
- raise RangeError, \
- 'can not handle overlapping ranges: %s and %s' % (address_range, t)
- return parent, parent_range
-
-def get_or_create_prefix(address_range):
- '''Returns a AddressRange object for the resource_range_ip specified
- as an argument. If no match is found, a new AddressRange object is
- created as a child of the best matching received resource.'''
-
- # get all resources from our parents
- prefix_set = models.AddressRange.objects.filter(
- from_cert__parent__in=conf.parents.all())
-
- # gross, since we store the address ranges as strings in the django
- # db, we can't use the normal __lte and __gte filters, so we get to
- # do it in python instead.
- for prefix in prefix_set:
- prefix_range = prefix.as_resource_range()
- if (prefix_range.min <= address_range.min and
- prefix_range.max >= address_range.max):
- # there should only ever be a single matching prefix
- break
- else:
- raise RangeError, '%s does not match any received address range.' % (
- address_range,)
-
- # find the best match among the children + grandchildren
- prefix, prefix_range = best_child(address_range, prefix, prefix_range)
-
- print 'best match for %s is %s' % (address_range, prefix)
- if prefix_range.min != address_range.min or prefix_range.max != address_range.max:
- # create suballocation
- print 'creating new range'
- prefix = models.AddressRange.objects.create(lo=str(address_range.min),
- hi=str(address_range.max), parent=prefix)
- return prefix
-
-def get_or_create_asn(asn):
- asn_set = models.Asn.objects.filter(lo__lte=asn.min, hi__gte=asn.max,
- from_cert__parent__in=conf.parents.all())
- if not asn_set:
- raise RangeError, '%s does not match any received AS range' % (asn,)
- best = best_child(asn, asn_set[0], asn_set[0].as_resource_range())[0]
- print 'best match for %s is %s' % (asn, best)
- if best.lo != asn.min or best.hi != asn.max:
- best = models.Asn.objects.create(lo=asn.min, hi=asn.max, parent=best)
- return best
-
-def do_asns():
- print 'processing', asn_csv
- for child_handle, asn in csv_reader(asn_csv, columns=2):
- asn_range = rpki.resource_set.resource_range_as.parse_str(asn)
- child = conf.children.get(handle=child_handle)
- asn = get_or_create_asn(asn_range)
- child.asn.add(asn)
-
-def do_prefixes():
- print 'processing', prefix_csv
- for child_handle, prefix in csv_reader(prefix_csv, columns=2):
- child = conf.children.get(handle=child_handle)
- try:
- rs = rpki.resource_set.resource_range_ipv4.parse_str(prefix)
- except ValueError, err:
- rs = rpki.resource_set.resource_range_ipv6.parse_str(prefix)
- obj = get_or_create_prefix(rs)
- obj.allocated = child
- obj.save()
-
-def do_roas():
- print 'processing', roa_csv
- for prefix, asn, group in csv_reader(roa_csv, columns=3):
- try:
- rs = rpki.resource_set.roa_prefix_ipv4.parse_str(prefix)
- except ValueError, err:
- rs = rpki.resource_set.roa_prefix_ipv6.parse_str(prefix)
-
- print str(rs.min()), str(rs.max()), rs.max_prefixlen
- obj = get_or_create_prefix(rs.to_resource_range())
- add_roa_requests(conf, obj, [int(asn)], rs.max_prefixlen)
-
-do_asns()
-do_prefixes()
-do_roas()
diff --git a/rpkid/portal-gui/scripts/roa_check.py b/rpkid/portal-gui/scripts/roa_check.py
deleted file mode 100755
index c280d935..00000000
--- a/rpkid/portal-gui/scripts/roa_check.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-# $Id$
-#
-# Runs through all the published ROAs and updates the Django DB with the
-# current active status of each defined ROA.
-#
-
-import socket
-
-from rcynic_output_iterator import rcynic_xml_iterator, rcynic_roa
-from rpki.resource_set import resource_set_ipv4, resource_set_ipv6
-from rpki.resource_set import roa_prefix_set_ipv4, roa_prefix_set_ipv6
-from rpki.resource_set import resource_range_ipv4, resource_range_ipv6
-from rpki.ipaddrs import v4addr, v6addr
-
-from rpki.gui.app.models import Roa
-
-# build up a list of all the authenticated roa's using the asn as the key
-roaiter = rcynic_xml_iterator(
- rcynic_root='/home/melkins/rcynic/rcynic-data/',
- xml_file='/home/melkins/rcynic/rcynic.xml')
-
-# key is an ASN
-# each element is a tuple of (resource_set_ipv4, resource_set_ipv6)
-roaauth = {}
-
-for roa in roaiter:
- if isinstance(roa, rcynic_roa):
- k = roa.asID
- if not roaauth.has_key(k):
- v = [resource_set_ipv4(), resource_set_ipv6()]
- roaauth[k] = v
- else:
- v = roaauth[k]
- for pfx in roa.prefix_sets:
- if isinstance(pfx, roa_prefix_set_ipv4):
- v[0] = v[0].union(pfx.to_resource_set())
- elif isinstance(pfx, roa_prefix_set_ipv6):
- v[1] = v[1].union(pfx.to_resource_set())
-
-#for k, v in roaauth.iteritems():
-# print 'asn %d : prefixes %s' % (k, ' '.join(map(str,v)))
-
-# run through all the ROA's in the GUI's database
-for roa in Roa.objects.all():
- k = int(roa.asn)
- valid = False
- if roaauth.has_key(k):
- # ensure that all prefixes listed in the roa are present
- # we convert the list of prefixes into prefix sets and use the
- # resource_set class to perform set comparisons
- ipv4_set = resource_set_ipv4()
- ipv6_set = resource_set_ipv6()
- for pfx in roa.prefix.all():
- # IP addresses are just stored as strings in the sqlite db
- try:
- ipv4_set.append(resource_range_ipv4(v4addr(str(pfx.lo)), v4addr(str(pfx.hi))))
- except socket.error:
- ipv6_set.append(resource_range_ipv6(v6addr(str(pfx.lo)), v6addr(str(pfx.hi))))
- r = roaauth[k]
- if ipv4_set.issubset(r[0]) and ipv6_set.issubset(r[1]):
- valid = True
- if valid:
- if not roa.active:
- roa.active = True
- roa.save()
- else:
- print 'roa for asn %s is not valid' % (roa.asn, )
- if roa.active:
- roa.active = False
- roa.save()
diff --git a/rpkid/portal-gui/scripts/rpkigui-import-routes.py b/rpkid/portal-gui/scripts/rpkigui-import-routes.py
new file mode 100644
index 00000000..9a3748d3
--- /dev/null
+++ b/rpkid/portal-gui/scripts/rpkigui-import-routes.py
@@ -0,0 +1,250 @@
+# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
+#
+# 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.
+
+__version__ = '$Id$'
+
+import itertools
+import _mysql_exceptions
+import optparse
+import os.path
+import re
+import sys
+import struct
+import subprocess
+import time
+import logging
+
+from django.db import transaction, connection
+
+from rpki.resource_set import resource_range_ipv4, resource_range_ipv6
+from rpki.exceptions import BadIPResource
+import rpki.gui.app.timestamp
+
+# globals
+BGPDUMP = 'bgpdump'
+logger = logging.getLogger(__name__)
+
+
+def parse_text(f):
+ ip_re = re.compile(r'^[0-9a-fA-F:.]+/\d{1,3}$')
+ last_prefix = None
+ cursor = connection.cursor()
+ range_class = resource_range_ipv4
+ table = 'routeview_routeorigin'
+ sql = "INSERT INTO %s_new SET asn=%%s, prefix_min=%%s, prefix_max=%%s" % table
+
+ try:
+ logger.info('Dropping existing staging table...')
+ cursor.execute('DROP TABLE IF EXISTS %s_new' % table)
+ except _mysql_exceptions.Warning:
+ pass
+
+ logger.info('Creating staging table...')
+ cursor.execute('CREATE TABLE %(table)s_new LIKE %(table)s' % {'table': table})
+
+ logger.info('Disabling autocommit...')
+ cursor.execute('SET autocommit=0')
+
+ logger.info('Adding rows to table...')
+ for row in itertools.islice(f, 5, None):
+ cols = row.split()
+
+ # index -1 is i/e/? for igp/egp
+ origin_as = cols[-2]
+ # FIXME: skip AS_SETs
+ if origin_as[0] == '{':
+ continue
+
+ prefix = cols[1]
+
+ # validate the prefix since the "sh ip bgp" output is sometimes
+ # corrupt by no space between the prefix and the next hop IP
+ # address.
+ net, bits = prefix.split('/')
+ if len(bits) > 2:
+ s = ['mask for %s looks fishy...' % prefix]
+ prefix = '%s/%s' % (net, bits[0:2])
+ s.append('assuming it should be %s' % prefix)
+ logger.warning(' '.join(s))
+
+ # the output may contain multiple paths to the same origin.
+ # if this is the same prefix as the last entry, we don't need
+ # to validate it again.
+ #
+ # prefixes are sorted, but the origin_as is not, so we keep a set to
+ # avoid duplicates, and insert into the db once we've seen all the
+ # origin_as values for a given prefix
+ if prefix != last_prefix:
+ # output routes for previous prefix
+ if last_prefix is not None:
+ try:
+ rng = range_class.parse_str(last_prefix)
+ rmin = long(rng.min)
+ rmax = long(rng.max)
+ cursor.executemany(sql, [(asn, rmin, rmax) for asn in asns])
+ except BadIPResource:
+ logger.warning('skipping bad prefix: ' + last_prefix)
+
+ asns = set()
+ last_prefix = prefix
+
+ asns.add(int(origin_as))
+
+ logger.info('Committing...')
+ cursor.execute('COMMIT')
+
+ try:
+ logger.info('Dropping old table...')
+ cursor.execute('DROP TABLE IF EXISTS %s_old' % table)
+ except _mysql_exceptions.Warning:
+ pass
+
+ logger.info('Swapping staging table with live table...')
+ cursor.execute('RENAME TABLE %(table)s TO %(table)s_old, %(table)s_new TO %(table)s' % {'table': table})
+
+ transaction.commit_unless_managed()
+
+ logger.info('Updating timestamp metadata...')
+ rpki.gui.app.timestamp.update('bgp_v4_import')
+
+
+def parse_mrt(f):
+ # filter input through bgpdump
+ pipe = subprocess.Popen([BGPDUMP, '-m', '-v', '-'], stdin=f,
+ stdout=subprocess.PIPE)
+
+ last_prefix = None
+ last_as = None
+ for e in pipe.stdout.readlines():
+ a = e.split('|')
+ prefix = a[5]
+ try:
+ origin_as = int(a[6].split()[-1])
+ except ValueError:
+ # skip AS_SETs
+ continue
+
+ if prefix != last_prefix:
+ last_prefix = prefix
+ elif last_as == origin_as:
+ continue
+ last_as = origin_as
+
+ asns = PREFIXES.get(prefix)
+ if not asns:
+ asns = set()
+ PREFIXES[prefix] = asns
+ asns.add(origin_as)
+
+ pipe.wait()
+ if pipe.returncode:
+ raise ProgException('bgpdump exited with code %d' % pipe.returncode)
+
+
+class ProgException(Exception):
+ pass
+
+
+class BadArgument(ProgException):
+ pass
+
+
+class UnknownInputType(ProgException):
+ pass
+
+
+class PipeFailed(ProgException):
+ pass
+
+
+if __name__ == '__main__':
+ start_time = time.time()
+
+ parser = optparse.OptionParser(usage='%prog [options] PATH',
+ description="""This tool is used to import the IPv4/6 BGP table dumps
+from routeviews.org into the RPKI Web Portal database. If the
+input file is a bzip2 compressed file, it will be decompressed
+automatically.""")
+ parser.add_option('-t', '--type', dest='filetype', metavar='TYPE',
+ help='Specify the input file type (auto, text, mrt) [Default: %default]')
+ parser.add_option('-l', '--level', dest='log_level', default='INFO',
+ help='Set logging level [Default: %default]')
+ parser.add_option('-u', '--bunzip2', dest='bunzip', metavar='PROG',
+ help='Specify bunzip2 program to use')
+ parser.add_option('-b', '--bgpdump', dest='bgpdump', metavar='PROG',
+ help='Specify path to bgdump binary')
+ parser.set_defaults(debug=False, verbose=False, filetype='auto')
+ options, args = parser.parse_args()
+
+ v = getattr(logging, options.log_level.upper())
+ logger.setLevel(v)
+ logging.basicConfig()
+ logger.info('logging level set to ' + logging.getLevelName(v))
+
+ if options.bgpdump:
+ BGPDUMP = os.path.expanduser(options.bgpdump)
+
+ try:
+ if len(args) != 1:
+ raise BadArgument('no filename specified, or more than one filename specified')
+ filename = args[0]
+
+ if options.filetype == 'auto':
+ # try to determine input type from filename, based on the default
+ # filenames from archive.routeviews.org
+ bname = os.path.basename(filename)
+ if bname.startswith('oix-full-snapshot-latest'):
+ filetype = 'text'
+ elif bname.startswith('rib.'):
+ filetype = 'mrt'
+ else:
+ raise UnknownInputType('unable to automatically determine input file type')
+ logging.info('Detected import format as "%s"' % filetype)
+ else:
+ filetype = options.filetype
+
+ pipe = None
+ if filename.endswith('.bz2'):
+ bunzip = 'bunzip2' if not options.bunzip else os.path.expanduser(options.bunzip)
+ logging.info('Decompressing input file on the fly...')
+ pipe = subprocess.Popen([bunzip, '--stdout', filename],
+ stdout=subprocess.PIPE)
+ input_file = pipe.stdout
+ else:
+ input_file = open(filename)
+
+ try:
+ dispatch = {'text': parse_text, 'mrt': parse_mrt}
+ dispatch[filetype](input_file)
+ except KeyError:
+ raise UnknownInputType('"%s" is an unknown input file type' % filetype)
+
+ if pipe:
+ logging.debug('Waiting for child to exit...')
+ pipe.wait()
+ if pipe.returncode:
+ raise PipeFailed('Child exited code %d' % pipe.returncode)
+ pipe = None
+ else:
+ input_file.close()
+
+ logger.info('Elapsed time %d secs' % (time.time() - start_time))
+ rc = 0
+
+ except ProgException, e:
+ logger.exception(e)
+ rc = 1
+
+ logging.shutdown()
+ sys.exit(rc)
diff --git a/rpkid/portal-gui/scripts/rpkigui-rcynic.py b/rpkid/portal-gui/scripts/rpkigui-rcynic.py
index 3dc0d9bd..3205fc8d 100644
--- a/rpkid/portal-gui/scripts/rpkigui-rcynic.py
+++ b/rpkid/portal-gui/scripts/rpkigui-rcynic.py
@@ -1,5 +1,5 @@
-# $Id$
# Copyright (C) 2011 SPARTA, Inc. dba Cobham Analytic Solutions
+# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -12,216 +12,212 @@
# 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.
-#
+
+__version__ = '$Id$'
default_logfile = '/var/rcynic/data/summary.xml'
default_root = '/var/rcynic/data'
-import time, vobject
+import time
+import vobject
+import logging
+
+from django.db import transaction
+import django.db.models
+from django.core.exceptions import ObjectDoesNotExist
+
+import rpki
+import rpki.gui.app.timestamp
from rpki.gui.cacheview import models
from rpki.rcynic import rcynic_xml_iterator, label_iterator
from rpki.sundial import datetime
-from django.db import transaction
-import django.db.models
-debug = False
-fam_map = { 'roa_prefix_set_ipv6': 6, 'roa_prefix_set_ipv4': 4 }
+logger = logging.getLogger(__name__)
-class rcynic_object(object):
- def __call__(self, vs):
- """
- do initial processing on a rcynic_object instance.
+def rcynic_cert(cert, obj):
+ obj.sia = cert.sia_directory_uri
- return value is a tuple: first element is a boolean value indicating whether
- the object is changed/new since the last time we processed it. second
- element is the db instance.
- """
- if debug:
- print 'processing %s at %s' % (vs.file_class.__name__, vs.uri)
+ # object must be saved for the related manager methods below to work
+ obj.save()
+ # resources can change when a cert is updated
+ obj.asns.clear()
+ obj.addresses.clear()
- # rcynic will generation <validation_status/> elements for objects
- # listed in the manifest but not found on disk
- if os.path.exists(vs.filename):
- q = self.model_class.objects.filter(uri=vs.uri)
+ for asr in cert.resources.asn:
+ logger.debug('processing %s' % asr)
+
+ attrs = {'min': asr.min, 'max': asr.max}
+ q = models.ASRange.objects.filter(**attrs)
+ if not q:
+ obj.asns.create(**attrs)
+ else:
+ obj.asns.add(q[0])
+
+ for cls, addr_obj, addrset in (models.AddressRange, obj.addresses, cert.resources.v4), (models.AddressRangeV6, obj.addresses_v6, cert.resources.v6):
+ for rng in addrset:
+ logger.debug('processing %s' % rng)
+
+ attrs = {'prefix_min': rng.min, 'prefix_max': rng.max}
+ q = cls.objects.filter(**attrs)
if not q:
- if debug:
- print 'creating new db instance'
- inst = self.model_class(uri=vs.uri)
+ addr_obj.create(**attrs)
else:
- inst = q[0]
+ addr_obj.add(q[0])
+
+
+def rcynic_roa(roa, obj):
+ obj.asid = roa.asID
+ # object must be saved for the related manager methods below to work
+ obj.save()
+ obj.prefixes.clear()
+ obj.prefixes_v6.clear()
+ for pfxset in roa.prefix_sets:
+ if pfxset.__class__.__name__ == 'roa_prefix_set_ipv6':
+ roa_cls = models.ROAPrefixV6
+ prefix_obj = obj.prefixes_v6
+ else:
+ roa_cls = models.ROAPrefixV4
+ prefix_obj = obj.prefixes
+
+ for pfx in pfxset:
+ attrs = {'prefix_min': pfx.min(),
+ 'prefix_max': pfx.max(),
+ 'max_length': pfx.max_prefixlen}
+ q = roa_cls.objects.filter(**attrs)
+ if not q:
+ prefix_obj.create(**attrs)
+ else:
+ prefix_obj.add(q[0])
- # determine if the object is changed/new
- mtime = os.stat(vs.filename)[8]
- if mtime != inst.mtime:
- inst.mtime = mtime
- obj = vs.obj # causes object to be lazily loaded
- inst.not_before = obj.notBefore.to_sql()
- inst.not_after = obj.notAfter.to_sql()
- if debug:
- sys.stderr.write('name=%s ski=%s\n' % (obj.subject, obj.ski))
- inst.name = obj.subject
- inst.keyid = obj.ski
- # look up signing cert
- if obj.issuer == obj.subject:
- # self-signed cert (TA)
- inst.cert = inst
- else:
- q = models.Cert.objects.filter(keyid=obj.aki, name=obj.issuer)
- if q:
- inst.issuer = q[0]
- else:
- sys.stderr.write('warning: unable to find signing cert with ski=%s (%s)\n' % (obj.aki, obj.issuer))
- return None
-
- self.callback(obj, inst)
- else:
- if debug:
- print 'object is unchanged'
+def rcynic_gbr(gbr, obj):
+ vcard = vobject.readOne(gbr.vcard)
+ logger.debug(vcard.prettyPrint())
+ obj.full_name = vcard.fn.value if hasattr(vcard, 'fn') else None
+ obj.email_address = vcard.email.value if hasattr(vcard, 'email') else None
+ obj.telephone = vcard.tel.value if hasattr(vcard, 'tel') else None
+ obj.organization = vcard.org.value[0] if hasattr(vcard, 'org') else None
+
+LABEL_CACHE = {}
- # save required to create new ValidationStatus object refering to it
- inst.save()
- inst.statuses.create(generation=models.generations_dict[vs.generation] if vs.generation else None,
- timestamp=datetime.fromXMLtime(vs.timestamp).to_sql(),
- status=models.ValidationLabel.objects.get(label=vs.status))
- return inst
+def save_statuses(inst, statuses):
+ for vs in statuses:
+ timestamp = datetime.fromXMLtime(vs.timestamp).to_sql()
+
+ # cache validation labels
+ if vs.status in LABEL_CACHE:
+ status = LABEL_CACHE[vs.status]
else:
- if debug:
- print 'ERROR - file is missing: %s' % vs.filename
+ status = models.ValidationLabel.objects.get(label=vs.status)
+ LABEL_CACHE[vs.status] = status
+
+ g = models.generations_dict[vs.generation] if vs.generation else None
- return True
+ inst.statuses.create(generation=g, timestamp=timestamp, status=status)
-class rcynic_cert(rcynic_object):
- model_class = models.Cert
+@transaction.commit_on_success
+def process_cache(root, xml_file):
+ dispatch = {
+ 'rcynic_certificate': rcynic_cert,
+ 'rcynic_roa': rcynic_roa,
+ 'rcynic_ghostbuster': rcynic_gbr
+ }
+ model_class = {
+ 'rcynic_certificate': models.Cert,
+ 'rcynic_roa': models.ROA,
+ 'rcynic_ghostbuster': models.Ghostbuster
+ }
- def callback(self, cert, obj):
- """
- Process a RPKI resource certificate.
- """
+ last_uri = None
+ statuses = []
- obj.sia = cert.sia_directory_uri
- obj.save()
+ logger.info('clearing validation statuses')
+ models.ValidationStatus.objects.all().delete()
- # resources can change when a cert is updated
- obj.asns.clear()
- obj.addresses.clear()
+ logger.info('updating validation status')
+ for vs in rcynic_xml_iterator(root, xml_file):
+ if vs.uri != last_uri:
+ if statuses:
+ obj, created = models.RepositoryObject.objects.get_or_create(uri=last_uri)
+ save_statuses(obj, statuses)
- for asr in cert.resources.asn:
- if debug:
- sys.stderr.write('processing %s\n' % asr)
+ statuses = []
+ last_uri = vs.uri
- attrs = { 'min': asr.min, 'max': asr.max }
- q = models.ASRange.objects.filter(**attrs)
+ statuses.append(vs)
+
+ if vs.status == 'object_accepted':
+ logger.debug('processing %s' % vs.filename)
+
+ cls = model_class[vs.file_class.__name__]
+ q = cls.objects.filter(repo__uri=vs.uri)
if not q:
- obj.asns.create(**attrs)
+ repo, created = models.RepositoryObject.objects.get_or_create(uri=vs.uri)
+ inst = cls(repo=repo)
else:
- obj.asns.add(q[0])
+ inst = q[0]
- for family, addrset in (4, cert.resources.v4), (6, cert.resources.v6):
- for rng in addrset:
- if debug:
- sys.stderr.write('processing %s\n' % rng)
+ # determine if the object is changed/new
+ mtime = os.stat(vs.filename)[8]
+ if mtime != inst.mtime:
+ inst.mtime = mtime
+ try:
+ obj = vs.obj # causes object to be lazily loaded
+ except rpki.POW._der.DerError, e:
+ logger.warning('Caught %s while processing %s: %s' % (type(e), vs.filename, e))
+ continue
- attrs = { 'family': family, 'min': str(rng.min), 'max': str(rng.max) }
- q = models.AddressRange.objects.filter(**attrs)
- if not q:
- obj.addresses.create(**attrs)
- else:
- obj.addresses.add(q[0])
-
- if debug:
- print 'finished processing rescert at %s' % cert.uri
-
-class rcynic_roa(rcynic_object):
- model_class = models.ROA
-
- def callback(self, roa, obj):
- obj.asid = roa.asID
- obj.save()
- obj.prefixes.clear()
- for pfxset in roa.prefix_sets:
- family = fam_map[pfxset.__class__.__name__]
- for pfx in pfxset:
- attrs = { 'family' : family,
- 'prefix': str(pfx.prefix),
- 'bits' : pfx.prefixlen,
- 'max_length': pfx.max_prefixlen }
- q = models.ROAPrefix.objects.filter(**attrs)
- if not q:
- obj.prefixes.create(**attrs)
- else:
- obj.prefixes.add(q[0])
+ inst.not_before = obj.notBefore.to_sql()
+ inst.not_after = obj.notAfter.to_sql()
+ inst.name = obj.subject
+ inst.keyid = obj.ski
-class rcynic_gbr(rcynic_object):
- model_class = models.Ghostbuster
+ # look up signing cert
+ if obj.issuer == obj.subject:
+ # self-signed cert (TA)
+ assert(isinstance(inst, models.Cert))
+ inst.issuer = inst
+ else:
+ try:
+ inst.issuer = models.Cert.objects.get(keyid=obj.aki, name=obj.issuer)
+ except ObjectDoesNotExist:
+ logger.warning('unable to find signing cert with ski=%s (%s)' % (obj.aki, obj.issuer))
+ continue
- def callback(self, gbr, obj):
- vcard = vobject.readOne(gbr.vcard)
- if debug:
- vcard.prettyPrint()
- obj.full_name = vcard.fn.value if hasattr(vcard, 'fn') else None
- obj.email_address = vcard.email.value if hasattr(vcard, 'email') else None
- obj.telephone = vcard.tel.value if hasattr(vcard, 'tel') else None
- obj.organization = vcard.org.value[0] if hasattr(vcard, 'org') else None
+ # do object-specific tasks
+ dispatch[vs.file_class.__name__](obj, inst)
-def process_cache(root, xml_file):
- start = time.time()
+ inst.save() # don't require a save in the dispatch methods
+ else:
+ logger.debug('object is unchanged')
- dispatch = {
- 'rcynic_certificate': rcynic_cert(),
- 'rcynic_roa' : rcynic_roa(),
- 'rcynic_ghostbuster': rcynic_gbr()
- }
+ # insert the saved validation statuses now that the object has been
+ # created.
+ save_statuses(inst.repo, statuses)
+ statuses = []
- # remove all existing ValidationStatus_* entries
- models.ValidationStatus_Cert.objects.all().delete()
- models.ValidationStatus_ROA.objects.all().delete()
- models.ValidationStatus_Ghostbuster.objects.all().delete()
-
- # loop over all rcynic objects and dispatch based on the returned
- # rcynic_object subclass
- n = 1
- defer = rcynic_xml_iterator(root, xml_file)
- while defer:
- if debug:
- print 'starting iteration %d for deferred objects' % n
- n = n + 1
-
- elts = defer
- defer = []
- for vs in elts:
- # need to defer processing this object, most likely because
- # the <validation_status/> element for the signing cert hasn't
- # been seen yet
- if not dispatch[vs.file_class.__name__](vs):
- defer.append(vs)
+ # process any left over statuses for an object that was not ultimately
+ # accepted
+ if statuses:
+ obj, created = models.RepositoryObject.objects.get_or_create(uri=last_uri)
+ save_statuses(obj, statuses)
# garbage collection
# remove all objects which have no ValidationStatus references, which
# means they did not appear in the last XML output
- if debug:
- print 'performing garbage collection'
+ logger.info('performing garbage collection')
- # trying to .delete() the querysets directly results in a "too many sql variables" exception
- for qs in (models.Cert.objects.annotate(num_statuses=django.db.models.Count('statuses')).filter(num_statuses=0),
- models.Ghostbuster.objects.annotate(num_statuses=django.db.models.Count('statuses')).filter(num_statuses=0),
- models.ROA.objects.annotate(num_statuses=django.db.models.Count('statuses')).filter(num_statuses=0)):
- for e in qs:
- e.delete()
-
- if debug:
- stop = time.time()
- sys.stdout.write('elapsed time %d seconds.\n' % (stop - start))
+ # Delete all objects that have zero validation status elements.
+ models.RepositoryObject.objects.annotate(num_statuses=django.db.models.Count('statuses')).filter(num_statuses=0).delete()
+@transaction.commit_on_success
def process_labels(xml_file):
- if debug:
- sys.stderr.write('updating labels...\n')
+ logger.info('updating labels...')
for label, kind, desc in label_iterator(xml_file):
- if debug:
- sys.stderr.write('label=%s kind=%s desc=%s\n' % (label, kind, desc))
+ logger.debug('label=%s kind=%s desc=%s' % (label, kind, desc))
if kind:
q = models.ValidationLabel.objects.filter(label=label)
if not q:
@@ -233,24 +229,33 @@ def process_labels(xml_file):
obj.status = desc
obj.save()
+
if __name__ == '__main__':
import optparse
parser = optparse.OptionParser()
- parser.add_option("-d", "--debug", action="store_true",
- help="enable debugging message")
+ parser.add_option("-l", "--level", dest="log_level", default='INFO',
+ help="specify the logging level [default: %default]")
parser.add_option("-f", "--file", dest="logfile",
- help="specify the rcynic XML file to parse [default: %default]",
- default=default_logfile)
+ help="specify the rcynic XML file to parse [default: %default]",
+ default=default_logfile)
parser.add_option("-r", "--root",
- help="specify the chroot directory for the rcynic jail [default: %default]",
- metavar="DIR", default=default_root)
+ help="specify the chroot directory for the rcynic jail [default: %default]",
+ metavar="DIR", default=default_root)
options, args = parser.parse_args(sys.argv)
- if options.debug:
- debug = True
- with transaction.commit_on_success():
- process_labels(options.logfile)
- process_cache(options.root, options.logfile)
+ v = getattr(logging, options.log_level.upper())
+ logger.setLevel(v)
+ logging.basicConfig()
+ logger.info('log level set to %s' % logging.getLevelName(v))
+
+ start = time.time()
+ process_labels(options.logfile)
+ process_cache(options.root, options.logfile)
+
+ rpki.gui.app.timestamp.update('rcynic_import')
+
+ stop = time.time()
+ logger.info('elapsed time %d seconds.' % (stop - start))
-# vim:sw=4 ts=8
+ logging.shutdown()
diff --git a/rpkid/portal-gui/scripts/rpkigui-reset-demo.py b/rpkid/portal-gui/scripts/rpkigui-reset-demo.py
new file mode 100644
index 00000000..acfddabd
--- /dev/null
+++ b/rpkid/portal-gui/scripts/rpkigui-reset-demo.py
@@ -0,0 +1,34 @@
+# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
+#
+# 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.
+
+"""
+This script is used to reset all of the labuser* accounts on demo.rpki.net back
+to a state suitable for a new workshop. It removes all ROAs and Ghostbuster
+issued by the labuser accounts.
+
+"""
+
+__version__ = '$Id$'
+
+from rpki.irdb.models import ROARequest, GhostbusterRequest, ResourceHolderCA
+from rpki.gui.app.glue import list_received_resources
+
+for n in xrange(1, 33):
+ username = 'labuser%02d' % n
+ print 'removing objects for ' + username
+ for cls in (ROARequest, GhostbusterRequest):
+ cls.objects.filter(issuer__handle=username).delete()
+ print '... updating resource certificate cache'
+ conf = ResourceHolderCA.objects.get(handle=username)
+ list_received_resources(sys.stdout, conf)
diff --git a/rpkid/portal-gui/scripts/rpkigui-response.py b/rpkid/portal-gui/scripts/rpkigui-response.py
deleted file mode 100755
index 9b150c51..00000000
--- a/rpkid/portal-gui/scripts/rpkigui-response.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# $Id$
-# Copyright (C) 2011 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 for use on the server side when using rpkidemo.
-# Takes a xml result from either configure_parent or
-# configure_publication_client and places it in the portal gui
-# outbox with the appropriate rfc822 header fields.
-
-import os
-os.environ['DJANGO_SETTINGS_MODULE'] = 'rpki.gui.settings'
-
-import sys
-import pwd
-import email.message, email.utils, mailbox
-from django.conf import settings
-
-if len(sys.argv) < 4:
- sys.stderr.write("""usage: rpkigui-response <target-handle> <response-type> <xml-response-file>
-
-<target-handle> the handle for the rpkidemo user to which this
- response should be sent
-
-<response-type> 'parent' for a configure_child response, or
- 'repository' for a configure_publication_client
- response
-
-<xml-response-file> the file containing the xml response for a
- configure_child or configure_publication_client
- command
-""")
-
- sys.exit(0)
-
-class InvalidResponseType(Exception):
- """
- Invalid response type.
- """
-
-request_type = sys.argv[2]
-if not request_type in ('parent', 'repository'):
- raise InvalidResponseType, 'invalid response type: %s' % request_type
-
-# make sure apache process can manipulate the outbox!
-os.setuid(pwd.getpwnam(settings.WEB_USER)[2])
-
-msg = email.message.Message()
-msg['X-rpki-self-handle'] = sys.argv[1]
-msg['X-rpki-type'] = request_type
-msg['Date'] = email.utils.formatdate()
-msg['Message-ID'] = email.utils.make_msgid()
-msg.set_type('application/x-rpki-setup')
-msg.set_payload(open(sys.argv[3]).read())
-
-box = mailbox.Maildir(settings.OUTBOX)
-box.add(msg)
-
-# vim:sw=4 ts=8 expandtab
diff --git a/rpkid/portal-gui/settings.py.in b/rpkid/portal-gui/settings.py.in
index 2800bc24..186f3f1d 100644
--- a/rpkid/portal-gui/settings.py.in
+++ b/rpkid/portal-gui/settings.py.in
@@ -6,13 +6,33 @@
# DO NOT EDIT! This file is automatically generated from
# settings.py.in
+import rpki.config
+
DEBUG = True
TEMPLATE_DEBUG = DEBUG
+# needs to be set prior to the call to rpki.config.parser so it knows
+# where to find the system rpki.conf
+rpki.config.default_dirname = '%(AC_SYSCONFDIR)s'
+
+# load the sql authentication bits from the system rpki.conf
+rpki_config = rpki.config.parser(section='web_portal')
+
DATABASES = {
'default' : {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME' : '%(AC_DATABASE_PATH)s'
+ 'ENGINE' : 'django.db.backends.mysql',
+ 'NAME' : rpki_config.get('sql-database'),
+ 'USER' : rpki_config.get('sql-username'),
+ 'PASSWORD': rpki_config.get('sql-password'),
+
+ # Ensure the default storage engine is InnoDB since we need
+ # foreign key support. The Django documentation suggests
+ # removing this after the syncdb is performed as an optimization,
+ # but there isn't an easy way to do this automatically.
+
+ 'OPTIONS' : {
+ 'init_command': 'SET storage_engine=INNODB'
+ }
}
}
@@ -50,13 +70,14 @@ ROOT_URLCONF = 'rpki.gui.urls'
INSTALLED_APPS = (
'django.contrib.auth',
- 'django.contrib.admin',
- 'django.contrib.admindocs',
+ #'django.contrib.admin',
+ #'django.contrib.admindocs',
'django.contrib.contenttypes',
'django.contrib.sessions',
-# 'django.contrib.staticfiles',
+ 'rpki.irdb',
'rpki.gui.app',
- 'rpki.gui.cacheview'
+ 'rpki.gui.cacheview',
+ 'rpki.gui.routeview',
)
TEMPLATE_CONTEXT_PROCESSORS = (
@@ -67,8 +88,3 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request"
)
-
-#STATIC_URL = '/static/'
-#STATIC_ROOT = '%(AC_DATAROOTDIR)s/rpki/gui/static'
-#STATICFILES_DIRS = (("admin", "%(AC_DJANGO_DIR)s/contrib/admin/media"),)
-#STATICFILES_FINDERS = ("django.contrib.staticfiles.finders.FileSystemFinder",)