From 9f88eb0bf2faa4bd6bf3b3f35c357efb11618000 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 1 Jan 2009 21:59:26 +0000 Subject: Added clamav and clamsmtp controllers with basic functionality. git-svn-id: svn://svn.alpinelinux.org/acf/clamav/trunk@1661 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ README | 1 + clamav-controller.lua | 22 ++++++++++++++++++++++ clamav-details-html.lsp | 17 +++++++++++++++++ clamav-expert-html.lsp | 1 + clamav-logfile-html.lsp | 7 +++++++ clamav-model.lua | 39 +++++++++++++++++++++++++++++++++++++++ clamav-startstop-html.lsp | 1 + clamav-status-html.lsp | 1 + clamav.menu | 4 ++++ clamav.roles | 3 +++ config.mk | 10 ++++++++++ 12 files changed, 150 insertions(+) create mode 100644 Makefile create mode 100644 README create mode 100644 clamav-controller.lua create mode 100644 clamav-details-html.lsp create mode 120000 clamav-expert-html.lsp create mode 100644 clamav-logfile-html.lsp create mode 100644 clamav-model.lua create mode 120000 clamav-startstop-html.lsp create mode 120000 clamav-status-html.lsp create mode 100644 clamav.menu create mode 100644 clamav.roles create mode 100644 config.mk diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5d28c73 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +APP_NAME=clamav +PACKAGE=acf-$(APP_NAME) +VERSION=0.1.0 + +APP_DIST=\ + clamav* \ + + +EXTRA_DIST=README Makefile config.mk + +DISTFILES=$(APP_DIST) $(EXTRA_DIST) + +TAR=tar + +P=$(PACKAGE)-$(VERSION) +tarball=$(P).tar.bz2 +install_dir=$(DESTDIR)/$(appdir)/$(APP_NAME) + +all: +clean: + rm -rf $(tarball) $(P) + +dist: $(tarball) + +install: + mkdir -p "$(install_dir)" + cp -a $(APP_DIST) "$(install_dir)" + +$(tarball): $(DISTFILES) + rm -rf $(P) + mkdir -p $(P) + cp -a $(DISTFILES) $(P) + $(TAR) -jcf $@ $(P) + rm -rf $(P) + +# target that creates a tar package, unpacks is and install from package +dist-install: $(tarball) + $(TAR) -jxf $(tarball) + $(MAKE) -C $(P) install DESTDIR=$(DESTDIR) + rm -rf $(P) + +include config.mk + +.PHONY: all clean dist install dist-install diff --git a/README b/README new file mode 100644 index 0000000..82b46ee --- /dev/null +++ b/README @@ -0,0 +1 @@ +ACF for clamav diff --git a/clamav-controller.lua b/clamav-controller.lua new file mode 100644 index 0000000..20baa25 --- /dev/null +++ b/clamav-controller.lua @@ -0,0 +1,22 @@ +module(..., package.seeall) + +-- Load libraries +require("controllerfunctions") + +default_action = "status" + +function status(self) + return self.model.getstatus() +end + +function startstop(self) + return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata) +end + +function details(self) + return self.model.getstatusdetails() +end + +function expert(self) + return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit ClamAV Config", "Configuration Set") +end diff --git a/clamav-details-html.lsp b/clamav-details-html.lsp new file mode 100644 index 0000000..f60bb13 --- /dev/null +++ b/clamav-details-html.lsp @@ -0,0 +1,17 @@ +<% local data, viewlibrary = ... +require("viewfunctions") +--[[ DEBUG INFORMATION +io.write("

DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(data)) +io.write("
") +--]] +%> + +<% viewlibrary.dispatch_component("status") %> + +

<%= data.label %>

+
+<% +displayitem(data) +%> +
diff --git a/clamav-expert-html.lsp b/clamav-expert-html.lsp new file mode 120000 index 0000000..207f324 --- /dev/null +++ b/clamav-expert-html.lsp @@ -0,0 +1 @@ +../expert-html.lsp \ No newline at end of file diff --git a/clamav-logfile-html.lsp b/clamav-logfile-html.lsp new file mode 100644 index 0000000..a2ef389 --- /dev/null +++ b/clamav-logfile-html.lsp @@ -0,0 +1,7 @@ +<% local data, viewlibrary = ... +require("viewfunctions") +%> + +<% if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {name="/var/log/messages", grep="clamav"}) +end %> diff --git a/clamav-model.lua b/clamav-model.lua new file mode 100644 index 0000000..90e2fa5 --- /dev/null +++ b/clamav-model.lua @@ -0,0 +1,39 @@ +module(..., package.seeall) + +-- Load libraries +require("modelfunctions") +require("fs") +require("format") + +-- Set variables +local configfile = "/etc/clamd.conf" +local processname = "clamd" +local packagename = "clamav" + +local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin " + +-- ################################################################################ +-- LOCAL FUNCTIONS + +-- ################################################################################ +-- PUBLIC FUNCTIONS + +function startstop_service(action) + return modelfunctions.startstop_service(processname, action) +end + +function getstatus() + return modelfunctions.getstatus(processname, packagename, "ClamAV Status") +end + +function getstatusdetails() + return cfe({ type="longtext", value="", label="ClamAV Status Details" }) +end + +function get_filedetails() + return modelfunctions.getfiledetails(configfile) +end + +function update_filedetails(filedetails) + return modelfunctions.setfiledetails(filedetails, {configfile}) +end diff --git a/clamav-startstop-html.lsp b/clamav-startstop-html.lsp new file mode 120000 index 0000000..0ea2627 --- /dev/null +++ b/clamav-startstop-html.lsp @@ -0,0 +1 @@ +../startstop-html.lsp \ No newline at end of file diff --git a/clamav-status-html.lsp b/clamav-status-html.lsp new file mode 120000 index 0000000..b2f8480 --- /dev/null +++ b/clamav-status-html.lsp @@ -0,0 +1 @@ +../status-html.lsp \ No newline at end of file diff --git a/clamav.menu b/clamav.menu new file mode 100644 index 0000000..58b1e4b --- /dev/null +++ b/clamav.menu @@ -0,0 +1,4 @@ +#CAT GROUP/DESC TAB ACTION +Applications 45ClamAV Status details +Applications 45ClamAV Expert expert +Applications 45ClamAV Logfile logfile diff --git a/clamav.roles b/clamav.roles new file mode 100644 index 0000000..e6f20f6 --- /dev/null +++ b/clamav.roles @@ -0,0 +1,3 @@ +USER=clamav:status,clamav:logfile,clamav:details,clamav:startstop +EXPERT=clamav:expert +ADMIN=clamav:status,clamav:logfile,clamav:details,clamav:startstop,clamav:expert diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..45f4d21 --- /dev/null +++ b/config.mk @@ -0,0 +1,10 @@ +prefix=/usr +datadir=${prefix}/share +sysconfdir=${prefix}/etc +localstatedir=${prefix}/var +acfdir=${datadir}/acf +wwwdir=${acfdir}/www +cgibindir=${acfdir}/cgi-bin +appdir=${acfdir}/app +acflibdir=${acfdir}/lib +sessionsdir=${localstatedir}/lib/acf/sessions -- cgit v1.2.3