added skeleton of new "encrypted webinterface" plugin -> managing ssl

This commit is contained in:
lars 2007-01-21 19:14:49 +00:00
parent f4b928e969
commit 1524e9d159
21 changed files with 570 additions and 0 deletions

View file

@ -0,0 +1,48 @@
#
# Copyright 2007 sense.lab e.V.
#
# This file is part of the CryptoBox.
#
# The CryptoBox is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# The CryptoBox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the CryptoBox; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""Create an SSL certificate to encrypt the webinterface connection via stunnel
"""
__revision__ = "$Id"
import cryptobox.plugins.base
class encrypted_webinterface(cryptobox.plugins.base.CryptoBoxPlugin):
"""Provide an encrypted webinterface connection via stunnel
"""
plugin_capabilities = [ "system" ]
plugin_visibility = []
request_auth = True
rank = 80
def do_action(self):
"""The action handler.
"""
return None
def get_status(self):
"""Retrieve the status of the feature.
"""
return "TODO"

View file

@ -0,0 +1,11 @@
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,12 @@
#: Name
msgid "Encrypted webinterface"
msgstr "Encrypted webinterface"
#: Title
msgid "Create encryption certificate"
msgstr "Create encryption certificate"
#: Button.CreateCertificate
msgid "Create certificate"
msgstr "Create certificate"

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,26 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-21 19:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"X-Generator: Translate Toolkit 0.10.1\n"
#: Name
msgid "Encrypted webinterface"
msgstr ""
#: Title
msgid "Create encryption certificate"
msgstr ""
#: Button.CreateCertificate
msgid "Create certificate"
msgstr ""

View file

@ -0,0 +1,7 @@
Name = Encrypted webinterface
Link = Encrypted webinterface
Title = Create encryption certificate
Button.CreateCertificate = Create certificate

View file

@ -0,0 +1,69 @@
#!/usr/bin/env python
#
# Copyright 2007 sense.lab e.V.
#
# This file is part of the CryptoBox.
#
# The CryptoBox is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# The CryptoBox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the CryptoBox; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
__revision__ = "$Id"
## necessary: otherwise CryptoBoxRootActions.py will refuse to execute this script
PLUGIN_TYPE = "cryptobox"
STUNNEL_BIN = "/usr/bin/stunnel"
import sys
import os
def run_stunnel(cert_file, src_port, dst_port):
import subprocess
if not src_port.isdigit():
sys.stderr.write("Source port is not a number: %s" % src_port)
return False
if not dst_port.isdigit():
sys.stderr.write("Destination port is not a number: %s" % dst_port)
return False
if not os.path.isfile(cert_file, src_port, dst_port):
sys.stderr.write("The certificate file (%s) does not exist!" % cert_file)
return False
proc = subprocess.Popen(
shell = False,
args = [ STUNNEL_BIN,
"-p", cert_file,
"-d", dst_port,
"-r", src_port ])
proc.wait()
return proc.returncode == 0
if __name__ == "__main__":
args = sys.argv[1:]
self_bin = sys.argv[0]
if len(args) != 3:
sys.stderr.write("%s: invalid number of arguments (%d instead of %d))\n" % \
(self_bin, len(args), 3))
sys.exit(1)
if not run_stunnel(args[0], args[1], args[2]):
sys.stderr.write("%s: failed to run 'stunnel'!")
sys.exit(100)
sys.exit(0)

View file

@ -0,0 +1,33 @@
#
# Copyright 2007 sense.lab e.V.
#
# This file is part of the CryptoBox.
#
# The CryptoBox is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# The CryptoBox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the CryptoBox; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
__revision__ = "$Id"
from cryptobox.tests.base import WebInterfaceTestClass
class unittests(WebInterfaceTestClass):
def test_get_cert_form(self):
"""retrieve the default form of the certificate manager"""
url = self.url + "encrypted_webinterface"
self.register_auth(url)
self.cmd.go(url)
self.cmd.find("Data.Status.Plugins.encrypted_webinterface")