aboutsummaryrefslogtreecommitdiff
path: root/rpkid/portal-gui
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/portal-gui')
-rw-r--r--rpkid/portal-gui/Makefile.in16
-rw-r--r--rpkid/portal-gui/apache.conf.in43
-rwxr-xr-xrpkid/portal-gui/routeviews.sh12
-rwxr-xr-xrpkid/portal-gui/scripts/rpkigui-apache-conf-gen57
4 files changed, 34 insertions, 94 deletions
diff --git a/rpkid/portal-gui/Makefile.in b/rpkid/portal-gui/Makefile.in
index ba206f5c..0725f793 100644
--- a/rpkid/portal-gui/Makefile.in
+++ b/rpkid/portal-gui/Makefile.in
@@ -22,27 +22,15 @@ RCYNIC_HTML_DIR=@RCYNIC_HTML_DIR@
INSTDIR=${DESTDIR}$(datarootdir)/rpki
-# automatically built sources
-BUILD=apache.conf
-
-all: $(BUILD)
+all:
+ @true
clean:
@true
distclean: clean
- rm -f $(BUILD)
rm -f Makefile
-edit = sed \
- -e 's|@INSTDIR[@]|$(INSTDIR)|g' \
- -e 's|@WSGI_DAEMON_PROCESS[@]|$(WSGI_DAEMON_PROCESS)|' \
- -e 's|@WSGI_PROCESS_GROUP[@]|$(WSGI_PROCESS_GROUP)|' \
- -e 's|@RCYNIC_HTML_DIR[@]|$(RCYNIC_HTML_DIR)|'
-
-apache.conf: $(srcdir)/apache.conf.in Makefile
- $(edit) $@.in > $@
-
install: all
deinstall uninstall:
diff --git a/rpkid/portal-gui/apache.conf.in b/rpkid/portal-gui/apache.conf.in
deleted file mode 100644
index 8b556f43..00000000
--- a/rpkid/portal-gui/apache.conf.in
+++ /dev/null
@@ -1,43 +0,0 @@
-# $Id$
-#
-# Sample apache configuration file for using the portal-gui with
-# mod_wsgi
-
-#
-# Configure the WSGI application to run as a separate process from the
-# Apache daemon itself.
-#
-@WSGI_DAEMON_PROCESS@
-@WSGI_PROCESS_GROUP@
-
-<Directory @INSTDIR@/wsgi>
- Order deny,allow
- Allow from all
-</Directory>
-
-#
-# Defines the URL to the portal-gui
-#
-WSGIScriptAlias / @INSTDIR@/wsgi/rpki.wsgi
-
-<Directory @INSTDIR@/media>
- Order deny,allow
- Allow from all
-</Directory>
-
-Alias /media/ @INSTDIR@/media/
-Alias /site_media/ @INSTDIR@/media/
-
-<Directory @RCYNIC_HTML_DIR@>
- Order deny,allow
- Allow from all
-</Directory>
-
-# Leave the trailing slash off the URL, otherwise /rcynic is swallowed by the
-# WSGIScriptAlias
-Alias /rcynic @RCYNIC_HTML_DIR@/
-
-# Redirect to the dashboard when someone hits the bare vhost
-RedirectMatch ^/$ /rpki/
-
-# vim:ft=apache
diff --git a/rpkid/portal-gui/routeviews.sh b/rpkid/portal-gui/routeviews.sh
deleted file mode 100755
index ad8f40ba..00000000
--- a/rpkid/portal-gui/routeviews.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-i=oix-full-snapshot-latest.dat.bz2
-o=/tmp/$i
-
-#curl -s -S -o $o http://archive.routeviews.org/oix-route-views/$i
-# wget is stock in Ubuntu so use that instead of curl
-wget -q -O $o http://archive.routeviews.org/oix-route-views/$i
-
-if [ $? -eq 0 ]; then
- rpkigui-import-routes -l error $o
-fi
diff --git a/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen b/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen
index 8968e89a..cbf0655a 100755
--- a/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen
+++ b/rpkid/portal-gui/scripts/rpkigui-apache-conf-gen
@@ -69,11 +69,6 @@ vhost = '''\
# Enable HTTPS
SSLEngine on
-
- # There's no perfect place to put these, but $sysconfdir/rpki isn't
- # a terrible place, and we can symlink from there to, eg, the
- # Debian/Ubuntu SnakeOil certificates if necessary.
- #
SSLCertificateFile %(sysconfdir)s/rpki/apache.cer
SSLCertificateKeyFile %(sysconfdir)s/rpki/apache.key
@@ -101,13 +96,15 @@ class Abstract(object):
def __init__(self, args):
self.args = args
- if args.verbose:
- print "Platform: %s, action: %s" % (self.__class__.__name__, args.action)
+ self.log("Platform: %s, action: %s" % (self.__class__.__name__, args.action))
getattr(self, args.action)()
- def run(self, *cmd, **kwargs):
+ def log(self, msg):
if self.args.verbose:
- print "Running", " ".join(cmd)
+ print msg
+
+ def run(self, *cmd, **kwargs):
+ self.log("Running %s" % " ".join(cmd))
subprocess.check_call(cmd, **kwargs)
req_cmd = ("openssl", "req", "-new",
@@ -135,8 +132,8 @@ class Abstract(object):
def unlink(self, fn, silent = False):
if os.path.exists(fn):
- if self.args.verbose and not silent:
- print "Removing", fn
+ if not silent:
+ self.log("Removing %s" % fn)
os.unlink(fn)
def del_certs(self, silent = False):
@@ -160,27 +157,30 @@ class Abstract(object):
raise subprocess.CalledProcessError(req.returncode, self.req_cmd)
if x509.wait():
raise subprocess.CalledProcessError(x509.returncode, self.x509_cmd)
- if self.args.verbose:
- print "Created", self.apache_cer, "and", self.apache_key, "chmoding", self.apache_key
+ self.log("Created %s and %s, chmoding %s" % (self.apache_cer, self.apache_key, self.apache_key))
os.chmod(self.apache_key, 0600)
def install(self):
with open(self.apache_conf_sample, "w") as f:
- if self.args.verbose:
- print "Writing", f.name
+ self.log("Writing %s" % f.name)
if self.apache_conf_preface is not None:
f.write(self.apache_conf_preface)
f.write(vhost)
if not os.path.exists(self.apache_conf):
- if self.args.verbose:
- print "Linking", apache_conf, "to", apache_conf_sample
- os.link(apache_conf_sample, apache_conf)
+ self.log("Linking %s to %s" % (self.apache_conf, self.apache_conf_sample))
+ os.link(self.apache_conf_sample, self.apache_conf)
if not os.path.exists(self.apache_conf_target):
- if self.args.verbose:
- print "Symlinking", self.apache_conf_target, "to", self.apache_conf
+ self.log("Symlinking %s to %s" % (self.apache_conf_target, self.apache_conf))
os.symlink(self.apache_conf, self.apache_conf_target)
self.add_certs()
- self.restart_apache()
+ self.enable()
+ self.restart()
+
+ def enable(self):
+ pass
+
+ def disable(self):
+ pass
def remove(self):
try:
@@ -191,10 +191,12 @@ class Abstract(object):
if same:
self.unlink(self.apache_conf)
self.unlink(self.apache_conf_target)
- self.restart_apache()
+ self.disable()
+ self.restart()
def purge(self):
self.remove()
+ self.unlink(self.apache_conf)
self.del_certs()
class Guess(Abstract):
@@ -228,12 +230,12 @@ class FreeBSD(Abstract):
NameVirtualHost *:443
''' + "\n"
- def restart_apache(self):
+ def restart(self):
self.run("service", "apache22", "restart")
class Debian(Abstract):
- apache_conf_target = "/etc/apache2/mods-available/rpki"
+ apache_conf_target = "/etc/apache2/sites-available/rpki"
snake_oil_cer = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
snake_oil_key = "/etc/ssl/private/ssl-cert-snakeoil.key"
@@ -246,9 +248,14 @@ class Debian(Abstract):
if not os.path.exists(self.apache_key):
os.symlink(self.snake_oil_key, self.apache_key)
- def restart_apache(self):
+ def enable(self):
self.run("a2enmod", "ssl")
self.run("a2ensite", "rpki")
+
+ def disable(self):
+ self.run("a2dissite", "rpki")
+
+ def restart(self):
self.run("service", "apache2", "restart")
class NIY(Abstract):