diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-08-25 09:57:39 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-08-25 09:57:39 +0000 |
commit | 02edfdc22bcc86b1e68b9a11364ca91d448b0c1a (patch) | |
tree | 453bafbe532aa4733e395d74232d5b18813b5cc1 | |
download | acf-heimdal-02edfdc22bcc86b1e68b9a11364ca91d448b0c1a.tar.bz2 acf-heimdal-02edfdc22bcc86b1e68b9a11364ca91d448b0c1a.tar.xz |
Initial cut at heimdal ACF.v0.1.0
-rw-r--r-- | Makefile | 44 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | config.mk | 10 | ||||
-rw-r--r-- | heimdal-controller.lua | 27 | ||||
l--------- | heimdal-expert-html.lsp | 1 | ||||
-rw-r--r-- | heimdal-kinit-html.lsp | 10 | ||||
-rw-r--r-- | heimdal-klist-html.lsp | 23 | ||||
-rw-r--r-- | heimdal-model.lua | 78 | ||||
l--------- | heimdal-status-html.lsp | 1 | ||||
-rw-r--r-- | heimdal.menu | 4 | ||||
-rw-r--r-- | heimdal.roles | 3 |
11 files changed, 202 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13f1080 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +APP_NAME=heimdal +PACKAGE=acf-$(APP_NAME) +VERSION=0.1.0 + +APP_DIST=\ + heimdal* \ + + +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 @@ -0,0 +1 @@ +ACF for heimdal 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 diff --git a/heimdal-controller.lua b/heimdal-controller.lua new file mode 100644 index 0000000..d602010 --- /dev/null +++ b/heimdal-controller.lua @@ -0,0 +1,27 @@ +module(..., package.seeall) + +-- Load libraries +require("controllerfunctions") + +default_action = "status" + +function status(self) + return self.model.getstatus() +end + +function expert(self) + return controllerfunctions.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Heimdal Config", "Configuration Set") +end + +function klist(self) + return self.model.klist() +end + +function kinit(self) + return controllerfunctions.handle_form(self, self.model.get_kinit, self.model.set_kinit, self.clientdata, "Submit", "Obtain Kerberos Ticket") +end + +function kdestroy(self) + return self:redirect_to_referrer(self.model.kdestroy()) +end + diff --git a/heimdal-expert-html.lsp b/heimdal-expert-html.lsp new file mode 120000 index 0000000..207f324 --- /dev/null +++ b/heimdal-expert-html.lsp @@ -0,0 +1 @@ +../expert-html.lsp
\ No newline at end of file diff --git a/heimdal-kinit-html.lsp b/heimdal-kinit-html.lsp new file mode 100644 index 0000000..3863b6f --- /dev/null +++ b/heimdal-kinit-html.lsp @@ -0,0 +1,10 @@ +<% local form, viewlibrary, page_info = ... +require("viewfunctions") +%> + +<H1><%= html.html_escape(form.label) %></H1> +<% + form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action + form.value.password.type = "password" + displayform(form) +%> diff --git a/heimdal-klist-html.lsp b/heimdal-klist-html.lsp new file mode 100644 index 0000000..c6997ff --- /dev/null +++ b/heimdal-klist-html.lsp @@ -0,0 +1,23 @@ +<% local data, viewlibrary, page_info, session = ... %> +<% require("viewfunctions") %> + +<% displaycommandresults({"kdestroy"}, session) %> +<% displaycommandresults({"kinit"}, session, true) %> + +<H1><%= data.label %></H1> +<pre> +<%= html.html_escape(data.value) %> +</pre> + +<% if viewlibrary and viewlibrary.dispatch_component and session.permissions[page_info.controller].kdestroy then %> +<DL> +<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/kdestroy") %>"> +<DT>Destroy Tickets</DT> +<DD><input class="submit" type="submit" value="Destroy"></DD> +</form> +</DL> +<% end %> + +<% if viewlibrary and viewlibrary.dispatch_component and session.permissions[page_info.controller].kinit then + viewlibrary.dispatch_component("kinit") +end %> diff --git a/heimdal-model.lua b/heimdal-model.lua new file mode 100644 index 0000000..9845c10 --- /dev/null +++ b/heimdal-model.lua @@ -0,0 +1,78 @@ +module(..., package.seeall) + +-- Load libraries +require("processinfo") +require("modelfunctions") +require("fs") +require("format") + +-- Set variables +local configfile = "/etc/krb5.conf" +local packagename = "heimdal" + +local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin " + +-- ################################################################################ +-- LOCAL FUNCTIONS + +-- ################################################################################ +-- PUBLIC FUNCTIONS + +function getstatus() + local status = {} + + local value, errtxt = processinfo.package_version(packagename) + status.version = cfe({ + label="Program version", + value=value, + errtxt=errtxt, + name=packagename + }) + + return cfe({ type="group", value=status, label="Heimdal Status" }) +end + +function get_filedetails() + return modelfunctions.getfiledetails(configfile) +end + +function update_filedetails(filedetails) + return modelfunctions.setfiledetails(filedetails, {configfile}) +end + +function get_kinit() + local value = {} + value.login = cfe({ label="KDC login" }) + value.password = cfe({ label="KDC password" }) + return cfe({ type="group", value=value, label="Kinit Parameters" }) +end + +function set_kinit(data) + local tmp = "/tmp/k"..os.time() + fs.write_file(tmp, data.value.password.value) + local cmd = path.."kinit --password-file="..tmp.." "..format.escapespecialcharacters(data.value.login.value).." 2>&1" + local f = io.popen(cmd) + data.descr = f:read("*a") or "" + f:close() + os.remove(tmp) + if data.descr == "" then data.descr = "Success" end + return data +end + +function klist() + local cmd = path.."klist" + local f = io.popen(cmd) + local result = f:read("*a") or "" + f:close() + if result == "" then result = "No tickets found" end + return cfe({ value=result, label="List of Kerberos Tickets" }) +end + +function kdestroy() + local cmd = path.."kdestroy" + local f = io.popen(cmd) + local result = f:read("*a") or "" + f:close() + if result == "" then result = "Success" end + return cfe({ value=result, label="Result of kdestroy" }) +end diff --git a/heimdal-status-html.lsp b/heimdal-status-html.lsp new file mode 120000 index 0000000..b2f8480 --- /dev/null +++ b/heimdal-status-html.lsp @@ -0,0 +1 @@ +../status-html.lsp
\ No newline at end of file diff --git a/heimdal.menu b/heimdal.menu new file mode 100644 index 0000000..8e80802 --- /dev/null +++ b/heimdal.menu @@ -0,0 +1,4 @@ +#CAT GROUP/DESC TAB ACTION +Applications 18Kerberos Status status +Applications 18Kerberos Tickets klist +Applications 18Kerberos Expert expert diff --git a/heimdal.roles b/heimdal.roles new file mode 100644 index 0000000..06e81b2 --- /dev/null +++ b/heimdal.roles @@ -0,0 +1,3 @@ +USER=heimdal:status,heimdal:klist +EXPERT=heimdal:kinit,heimdal:expert,heimdal:kdestroy +ADMIN=heimdal:status,heimdal:klist,heimdal:kinit,heimdal:expert,heimdal:kdestroy |