diff --git a/bin/cryptobox.conf b/bin/cryptobox.conf index 0262b23..31c80c8 100644 --- a/bin/cryptobox.conf +++ b/bin/cryptobox.conf @@ -99,3 +99,8 @@ CryptoBoxRootActions = CryptoBoxRootActionsLocal #[[network]] #interface = eth0 +## Uncomment the following lines to enable downloads of system +## logfiles via frontend. Make sure they are readable for the uid the +## cryptobox server runs with. +#[[logs]] +#syslogfile = /var/log/syslog diff --git a/plugins/logs/language.hdf b/plugins/logs/language.hdf index 6af1d81..11f18a1 100644 --- a/plugins/logs/language.hdf +++ b/plugins/logs/language.hdf @@ -8,6 +8,7 @@ Text { AtLeastWarnings = Show warnings and errors OnlyErrors = Show errors only DownloadLogFile = Download complete log + DownloadSysLogFile = Download complete syslog AgeOfEvent = Time passed EventText = Description TimeUnits { diff --git a/plugins/logs/logs.py b/plugins/logs/logs.py index 5a6766b..5910e3c 100644 --- a/plugins/logs/logs.py +++ b/plugins/logs/logs.py @@ -25,7 +25,7 @@ __revision__ = "$Id$" import cryptobox.plugins.base -import re +import re, os import datetime import cherrypy @@ -71,6 +71,20 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin): self.__set_line_hdf_data(self.hdf_prefix + "Content.%d" % index, line) self.hdf[self.hdf_prefix + "Destination"] = \ self.cbox.prefs["Log"]["Destination"].lower() + + ## this generates more download buttons if the files are available + try: + syslogfile = self.defaults["syslogfile"].lower() + if os.access(syslogfile, os.R_OK): + self.cbox.log.info("[logs]->syslogfile: '%s' will be exported" % syslogfile) + self.hdf[self.hdf_prefix + "syslogfile"] = "readable" + else: + self.cbox.log.warn("[logs]->syslogfile: '%s' is not readable for cryptobox user" % syslogfile) + self.hdf[self.hdf_prefix + "syslogfile"] = "not readable" + except KeyError: + self.cbox.log.error( + "could not evaluate the config setting: " + + "[logs]->syslogfile") return "show_log" @@ -87,7 +101,6 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin): return cherrypy.lib.cptools.serveFile(log_file, disposition="attachment", name="cryptobox_logfile.txt") - def get_status(self): """The current status includes the log configuration details. """ diff --git a/plugins/logs/show_log.cs b/plugins/logs/show_log.cs index 96c8dcb..314b3f2 100644 --- a/plugins/logs/show_log.cs +++ b/plugins/logs/show_log.cs @@ -66,10 +66,18 @@

- +

+ + +

+ +

+

diff --git a/src/cryptobox/web/sites.py b/src/cryptobox/web/sites.py index 68bf92b..6eeca34 100644 --- a/src/cryptobox/web/sites.py +++ b/src/cryptobox/web/sites.py @@ -434,7 +434,22 @@ class WebInterfaceSites: time.sleep(1) yield "

" - + @cherrypy.expose + def syslog(self, weblang="", help="0", device=None): + """export syslog + """ + from cherrypy.lib.cptools import serveFile + try: + syslogfile = self.cbox.prefs["PluginSettings"]["logs"]["syslogfile"] + if os.access(syslogfile, os.R_OK): + return serveFile(syslogfile, disposition="attachment", name="syslog") + else: + self.cbox.log.error("'%s' could not be exposed" % syslogfile) + except KeyError: + self.cbox.log.error( + "could not evaluate the config setting: " + + "[logs]->syslogfile %s") + ##################### input checker ##########################