diff options
author | Alexander Poslavsky <alexander.poslavsky@gmail.com> | 2007-11-02 09:24:27 +0000 |
---|---|---|
committer | Alexander Poslavsky <alexander.poslavsky@gmail.com> | 2007-11-02 09:24:27 +0000 |
commit | ccc6fc77ca7f75294c45f3cd571473488df0042d (patch) | |
tree | 6ae3291364c2a46ea48c176ac0f3f669355fe40d | |
parent | 1f2bc0676beae8672512edc37fff46a5e76b02a2 (diff) | |
download | acf-shorewall-ccc6fc77ca7f75294c45f3cd571473488df0042d.tar.bz2 acf-shorewall-ccc6fc77ca7f75294c45f3cd571473488df0042d.tar.xz |
trying to get shorewall to install+status indicator, cleanup
git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@252 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | app/cfgfile/firewall.cfg | 55 | ||||
-rw-r--r-- | app/shorewall-controller.lua | 102 | ||||
-rw-r--r-- | app/shorewall-html.lsp | 41 | ||||
-rw-r--r-- | app/shorewall-read-html.lsp | 24 | ||||
-rw-r--r-- | app/shorewall-restart-html.lsp | 66 | ||||
-rw-r--r-- | app/shorewall-start-html.lsp | 66 | ||||
-rw-r--r-- | app/shorewall-stop-html.lsp | 66 | ||||
-rw-r--r-- | app/shorewall.menu | 2 |
8 files changed, 0 insertions, 422 deletions
diff --git a/app/cfgfile/firewall.cfg b/app/cfgfile/firewall.cfg deleted file mode 100644 index 60ba9d6..0000000 --- a/app/cfgfile/firewall.cfg +++ /dev/null @@ -1,55 +0,0 @@ ---[[ cfgfile-model loads all .cfg files in this directory and - evaluates them by putting return ({ ... }) around file contents. - This file contains body of lua table with one item per config file. - Each item is table with following keys currently having meaning: - app - string that is used to group items by controller - section - string that is used to group items visually on page - name - short name that is shown to user - filename - filesystem path of config file - descr - descr, one liner ---]] - -{ app="firewall", section="general", - name="params", filename="/etc/shorewall/params", - descr="Define variables used in the other configuration files." }, -{ app="firewall", section="general", - name="shorewall", filename="/etc/shorewall/shorewall.conf", - descr="Modify global configuration settings." }, -{ app="firewall", section="firewalling", - name="zones", filename="/etc/shorewall/zones", - descr="Name network partitions. Firewall rules are applied to defined zones." }, -{ app="firewall", section="firewalling", - name="interfaces", filename="/etc/shorewall/interfaces", - descr="Map physical interfaces to named zones." }, -{ app="firewall", section="firewalling", - name="hosts", filename="/etc/shorewall/hosts", - descr="Name specific hosts within zones." }, -{ app="firewall", section="firewalling", - name="policy", filename="/etc/shorewall/policy", - descr="Set default rules (policies) for zones." }, -{ app="firewall", section="firewalling", - name="rules", filename="/etc/shorewall/rules", - descr="Define exceptions to policies." }, -{ app="firewall", section="firewalling", - name="routestopped", filename="/etc/shorewall/routestopped", - descr="Define hosts that can access this host when the firewall is \"stopped\"" }, -{ app="firewall", section="firewalling", - name="tunnels", filename="/etc/shorewall/tunnels", - descr="Specify ipsec tunnel endpoints" }, -{ app="firewall", section="firewalling", - name="blacklist", filename="/etc/shorewall/blacklist", - descr="List ip addresses or names that should be denied all access to the firewall." }, -{ app="firewall", section="nat", - name="masq", filename="/etc/shorewall/masq", - descr="Define dynamic Masquerading or DNAT tables" }, -{ app="firewall", section="nat", - name="nat", filename="/etc/shorewall/nat", - descr="Define static Network Address Translation table" }, -{ app="firewall", section="qos", - name="tos", filename="/etc/shorewall/tos", - descr="Specify type of service markers for packets traversing the firewall." }, -{ app="firewall", section="qos", - name="tcrules", filename="/etc/shorewall/tcrules", - descr="Define traffic control rules." }, - --- /* vim: set filetype=lua : */ diff --git a/app/shorewall-controller.lua b/app/shorewall-controller.lua deleted file mode 100644 index f1583cf..0000000 --- a/app/shorewall-controller.lua +++ /dev/null @@ -1,102 +0,0 @@ -module(..., package.seeall) - -local list_redir = function(self) - self.conf.action = "read" - self.conf.type = "redir" - error(self.conf) -end - -mvc={} -mvc.on_load = function(self, parent) - --TODO: This needs to be looked at - --there has to be cute, standard way of loading models into controller - self.cfgfile = self:soft_require("cfgfile-model") - setmetatable(self.cfgfile, self.cfgfile) - self.cfgfile.__index = self.worker - self.service = self:soft_require("service-model") - setmetatable(self.service, self.service) - self.service.__index = self.worker - if (self.worker[self.conf.action] == nil) or (self.conf.action == "init") then - self.worker[self.conf.action] = list_redir(self) - end -end - --- Public methods --- <prefix>/hostname/get - -read = function(self) - return { - list=self.cfgfile:list("firewall"), - script=ENV["SCRIPT_NAME"], - prefix=self.conf.prefix, - controller=self.conf.controller, - action="update", - } -end - -update = function(self) - local id = tonumber(self.clientdata.id) or -1 - local result - local data - - result, data = self.cfgfile:get(id) - if not result then return list_redir(self) end - - if self.clientdata.cmd then - for k,v in pairs (data) do - if self.clientdata[k] then - data[k].value = self.clientdata[k] - end - end - result, data = self.cfgfile:set(id, data) - if result then return list_redir(self) end - end - - data.cmd = cfe { type="action", value="save", label="action" } - return cfe{ type="form", - option={ script=ENV["SCRIPT_NAME"], - prefix=self.conf.prefix, - controller = self.conf.controller, - action = "update", - extra = ""}, - value = data} -end - -local function service(self, action) - local id = tonumber(self.clientdata.id) or -1 - local svc = self.service:list("firewall") - local ret = { - script=ENV["SCRIPT_NAME"], - prefix=self.conf.prefix, - controller = self.conf.controller, - action={}, - title="Firewall", - text={}, - active={ id=id } - } - for i,s in pairs(svc) do - for i,a in ipairs(s.actions) do - ret.action[#ret.action + 1] = { - name = a, - section = s.name .. " (" .. tostring(s.status) .. ")", - id = s.id, - label = a, - } - end - end - if self.clientdata[action] then - local result, report = self.service:update(id, action) - local label = "Error" - if result then - ret.active.action = action - label = "Report" - end - ret.text[#ret.text + 1] = { label=label, content=report } - end - return ret -end - -start = function(self) return service(self, "start") end -stop = function(self) return service(self, "stop") end -restart = function(self) return service(self, "restart") end - diff --git a/app/shorewall-html.lsp b/app/shorewall-html.lsp deleted file mode 100644 index efb1c38..0000000 --- a/app/shorewall-html.lsp +++ /dev/null @@ -1,41 +0,0 @@ -<? -local form = ... -?><h1>Edit <?= form.value.name.value -?></h1><?= html.form.start{ - method="POST", - action= form.option.script .. "/" .. form.option.prefix - .. form.option.controller .. "/" .. form.option.action .. - form.option.extra -} -?><table><? -local myform = form.value -local tags = { - { "content", "longtext" }, - { "cmd", "action" }, - { "id", "hidden" }, -} - -for i,v in pairs(tags) do - local name = v[1] - local val = myform[name] - val.type = v[2] - ?><tr><td><? ---[[ - if val.label then - io.write(val.label) - elseif val.type ~= "hidden" then - io.write(name) - end ---]] - ?></td><td><? - if val.name == "" then val.name = name end - if val.type == "longtext" then - val.cols = 80 - val.rows = 24 - end - ?><?= html.form[val.type](val) - ?></td></tr><? -end -?></table><?= html.form.stop() -?> - diff --git a/app/shorewall-read-html.lsp b/app/shorewall-read-html.lsp deleted file mode 100644 index c4732a0..0000000 --- a/app/shorewall-read-html.lsp +++ /dev/null @@ -1,24 +0,0 @@ -<? local view = ... ?> - -<? --Status Block - -?> - -<h1>Edit</h1> -<table border=0> -<? local sct="" -for i,item in ipairs(view.list) do - if item.section ~= sct then - ?><tr><td colspan='3'><h2><?= item.section ?></td></tr><? - sct = item.section - end - ?><tr><td><?= item.status or '' ?><? - ?><td><?= html.link{ - value = view.script .. view.prefix .. view.controller .. "/" - .. view.action .. "?id=" .. tostring(item.id), - label=item.name - } - ?></td><td><?= item.descr - ?></td></tr><? -end ?> -</table> diff --git a/app/shorewall-restart-html.lsp b/app/shorewall-restart-html.lsp deleted file mode 100644 index 2daa4bc..0000000 --- a/app/shorewall-restart-html.lsp +++ /dev/null @@ -1,66 +0,0 @@ -<? -local view = ... - -local function packURL(script, prefix, controller, action, extra) - ret = script .. "/" .. prefix .. controller .. "/" .. action - sep = '?' - for k,v in pairs(extra) do - ret = ret .. sep .. k .. '=' .. v - sep = '&' - end - return ret -end - ---[[ -view - script, prefix, controller - action[] - name, script, prefix, controller - section - id - label - disabled - active - id - action - title - text[] - label - content ---]] -?><h1><?= view.title -?></h1><? - -local section = "" -for i,item in ipairs(view.action) do - if section ~= item.section then - section = item.section - ?><h2><?= section ?></h2><? - end - if item.disabled then - ?><i><?= item.label or item.name ?></i><? - else - ?><?= html.form.start { - method="POST", - action = packURL(item.script or view.script, - item.prefix or view.prefix, - item.controller or view.controller, - item.name, {}) - } ?><?= html.form.hidden { name="id", value=item.id } ?><? - local label = (item.label or item.name) - if item.id == view.active.id and item.name == view.active.action then - label = '['..label..']' - end - ?><?= html.form.submit { - name = item.name, value = label - } ?><?= html.form.stop() ?><? - end -end -for i,item in ipairs(view.text) do - if item.label then - ?><h2><?= item.label ?></h2><? - end - ?><pre><?= item.content ?></pre><? -end --- vim: set filetype=lua : -?> diff --git a/app/shorewall-start-html.lsp b/app/shorewall-start-html.lsp deleted file mode 100644 index 2daa4bc..0000000 --- a/app/shorewall-start-html.lsp +++ /dev/null @@ -1,66 +0,0 @@ -<? -local view = ... - -local function packURL(script, prefix, controller, action, extra) - ret = script .. "/" .. prefix .. controller .. "/" .. action - sep = '?' - for k,v in pairs(extra) do - ret = ret .. sep .. k .. '=' .. v - sep = '&' - end - return ret -end - ---[[ -view - script, prefix, controller - action[] - name, script, prefix, controller - section - id - label - disabled - active - id - action - title - text[] - label - content ---]] -?><h1><?= view.title -?></h1><? - -local section = "" -for i,item in ipairs(view.action) do - if section ~= item.section then - section = item.section - ?><h2><?= section ?></h2><? - end - if item.disabled then - ?><i><?= item.label or item.name ?></i><? - else - ?><?= html.form.start { - method="POST", - action = packURL(item.script or view.script, - item.prefix or view.prefix, - item.controller or view.controller, - item.name, {}) - } ?><?= html.form.hidden { name="id", value=item.id } ?><? - local label = (item.label or item.name) - if item.id == view.active.id and item.name == view.active.action then - label = '['..label..']' - end - ?><?= html.form.submit { - name = item.name, value = label - } ?><?= html.form.stop() ?><? - end -end -for i,item in ipairs(view.text) do - if item.label then - ?><h2><?= item.label ?></h2><? - end - ?><pre><?= item.content ?></pre><? -end --- vim: set filetype=lua : -?> diff --git a/app/shorewall-stop-html.lsp b/app/shorewall-stop-html.lsp deleted file mode 100644 index 2daa4bc..0000000 --- a/app/shorewall-stop-html.lsp +++ /dev/null @@ -1,66 +0,0 @@ -<? -local view = ... - -local function packURL(script, prefix, controller, action, extra) - ret = script .. "/" .. prefix .. controller .. "/" .. action - sep = '?' - for k,v in pairs(extra) do - ret = ret .. sep .. k .. '=' .. v - sep = '&' - end - return ret -end - ---[[ -view - script, prefix, controller - action[] - name, script, prefix, controller - section - id - label - disabled - active - id - action - title - text[] - label - content ---]] -?><h1><?= view.title -?></h1><? - -local section = "" -for i,item in ipairs(view.action) do - if section ~= item.section then - section = item.section - ?><h2><?= section ?></h2><? - end - if item.disabled then - ?><i><?= item.label or item.name ?></i><? - else - ?><?= html.form.start { - method="POST", - action = packURL(item.script or view.script, - item.prefix or view.prefix, - item.controller or view.controller, - item.name, {}) - } ?><?= html.form.hidden { name="id", value=item.id } ?><? - local label = (item.label or item.name) - if item.id == view.active.id and item.name == view.active.action then - label = '['..label..']' - end - ?><?= html.form.submit { - name = item.name, value = label - } ?><?= html.form.stop() ?><? - end -end -for i,item in ipairs(view.text) do - if item.label then - ?><h2><?= item.label ?></h2><? - end - ?><pre><?= item.content ?></pre><? -end --- vim: set filetype=lua : -?> diff --git a/app/shorewall.menu b/app/shorewall.menu deleted file mode 100644 index 21066d5..0000000 --- a/app/shorewall.menu +++ /dev/null @@ -1,2 +0,0 @@ -Networking Shorewall Define read - |