From 6f05e1d091b054462ae3ea599d48a2b9aa2eb335 Mon Sep 17 00:00:00 2001 From: age Date: Tue, 15 Jan 2008 00:14:19 +0000 Subject: [PATCH] * reverted changes [996] and [998] for good old logfile download --- bin/cryptobox.conf | 5 ----- plugins/logs/language.hdf | 1 - plugins/logs/logs.py | 46 +++++++++++--------------------------- plugins/logs/show_log.cs | 12 ++-------- src/cryptobox/web/sites.py | 4 +--- 5 files changed, 16 insertions(+), 52 deletions(-) diff --git a/bin/cryptobox.conf b/bin/cryptobox.conf index 839995e..73242a5 100644 --- a/bin/cryptobox.conf +++ b/bin/cryptobox.conf @@ -100,8 +100,3 @@ 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 11f18a1..6af1d81 100644 --- a/plugins/logs/language.hdf +++ b/plugins/logs/language.hdf @@ -8,7 +8,6 @@ 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 b4ae765..1398067 100644 --- a/plugins/logs/logs.py +++ b/plugins/logs/logs.py @@ -25,7 +25,7 @@ __revision__ = "$Id$" import cryptobox.plugins.base -import re, os +import re import datetime import cherrypy @@ -69,52 +69,32 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin): level = None for (index, line) in enumerate(self.__filter_log_content(lines, size, level)): self.__set_line_hdf_data(self.hdf_prefix + "Content.%d" % index, line) - self.hdf[self.hdf_prefix + "Destination"] = \ + self.hdf[self.hdf_prefix + "Destination"] = \ self.cbox.prefs["Log"]["Destination"].lower() - - ## this generates more download buttons if the files are available - if "syslogfile" in self.defaults: - try: - syslogfile = self.defaults["syslogfile"] - except KeyError: - self.cbox.log.error("could not evaluate the config setting: " - + "[logs]->syslogfile") - if syslogfile and os.access(syslogfile, os.R_OK): - self.cbox.log.info("[logs]->syslogfile: '%s' will be exported" % syslogfile) - self.hdf[self.hdf_prefix + "syslogfile"] = "readable" - self.cbox.prefs["Log"]["syslogfile"] = syslogfile - else: - self.cbox.log.warn("[logs]->syslogfile: '%s' is not readable for cryptobox user" % syslogfile) - self.hdf[self.hdf_prefix + "syslogfile"] = "not readable" return "show_log" @cherrypy.expose def download(self, **kargs): """Download the complete log file - **kargs are necessary - we have to ignore 'weblang' and so on ... """ - ##TODO: check the download url to know which file is wanted - if self.cbox.prefs["Log"]["syslogfile"]: - try: - syslogfile = self.cbox.prefs["Log"]["syslogfile"] - except KeyError: - self.cbox.log.error("could not evaluate the config setting: " - + "[logs]->syslogfile %s") - if syslogfile and os.access(syslogfile, os.R_OK): - return cherrypy.lib.cptools.serveFile(syslogfile, - disposition="attachment", name="syslog.txt") - else: - self.cbox.log.error("'%s' could not be exposed" % syslogfile) - log_file = self.__get_log_destination_file() if log_file is None: return "" else: return cherrypy.lib.cptools.serveFile(log_file, - disposition="attachment", name="cryptobox_logfile.txt") - + disposition="attachment", name="cryptobox_logfile.txt") + + + def get_status(self): + """The current status includes the log configuration details. + """ + return "%s:%s:%s" % ( + self.cbox.prefs["Log"]["Level"], + self.cbox.prefs["Log"]["Destination"], + self.cbox.prefs["Log"]["Details"]) + 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 c9e88c1..74fd8f6 100644 --- a/plugins/logs/show_log.cs +++ b/plugins/logs/show_log.cs @@ -66,18 +66,10 @@

- +

- - -

- -

-

diff --git a/src/cryptobox/web/sites.py b/src/cryptobox/web/sites.py index 79ecc37..c30be12 100644 --- a/src/cryptobox/web/sites.py +++ b/src/cryptobox/web/sites.py @@ -434,9 +434,7 @@ class WebInterfaceSites: time.sleep(1) yield "

" - - - ##################### input checker ########################## + ##################### input checker ########################## def __check_environment(self): """inform the user of suspicious environmental problems