diff options
author | Mika Havela <mika.havela@gmail.com> | 2007-12-01 08:19:17 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2007-12-01 08:19:17 +0000 |
commit | 7cd319e88461c9ef700d4925b236b5091aef00a1 (patch) | |
tree | 632620fa21098fd7105dbdce6f078dcc4aa754ba | |
parent | 2beb00dd81c1f2dceeef0e62cf89d2d1b1109b6a (diff) | |
download | acf-shorewall-7cd319e88461c9ef700d4925b236b5091aef00a1.tar.bz2 acf-shorewall-7cd319e88461c9ef700d4925b236b5091aef00a1.tar.xz |
Cleaning up dir and some code
git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@397 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | firewall.cfg | 44 | ||||
-rw-r--r-- | shorewall-check-html.lsp | 27 | ||||
-rw-r--r-- | shorewall-edit-html.lsp | 38 | ||||
-rw-r--r-- | shorewall-model.lua | 2 | ||||
-rw-r--r-- | shorewall-read-html.lsp | 34 | ||||
-rw-r--r-- | shorewall-restart-html.lsp | 71 | ||||
-rw-r--r-- | shorewall-stop-html.lsp | 71 |
7 files changed, 38 insertions, 249 deletions
diff --git a/firewall.cfg b/firewall.cfg deleted file mode 100644 index 0a143d4..0000000 --- a/firewall.cfg +++ /dev/null @@ -1,44 +0,0 @@ --- /* vim: set filetype=lua : */ -{ 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." }, - diff --git a/shorewall-check-html.lsp b/shorewall-check-html.lsp new file mode 100644 index 0000000..0378928 --- /dev/null +++ b/shorewall-check-html.lsp @@ -0,0 +1,27 @@ +<? local view = ... ?> + +<h1>Firewall configuration</h1> + +<h2>SHOREWALL CHECK RESULT</h2> +<textarea name="checkresult" style="width:100%;height:400px;"><?= view.check.result ?></textarea> + +<h2>SHOW CONFIG FILES</h2> + +<dt><?= html.link{value = view.url .. "/list", label="View all files/configs" } ?></dt> +<dd>Provide a autogenerated list of files in '/etc/shorewall'.</dd> + +<h2>MANAGEMENT</h2> + +<dt>Preform check of configs</dt> +<dd><form name="check" action="" method="POST"><input type=submit name="cmd" value="check" style="width:100px"></form></dd> + +<dt>Preform restart of firewall</dt> +<dd><form name="check" action="<? io.write(view.url .. "/read") ?>" method="POST"><input type=submit name="cmd" value="restart" style="width:100px"></form><? if (view.check.restart) then io.write(view.programstats.restart) end ?></dd> + +<? +--[[ DEBUG INFORMATION +require("debugs") +io.write(debugs.variables(view)) +--]] +?> + diff --git a/shorewall-edit-html.lsp b/shorewall-edit-html.lsp index 86d5507..f9ce486 100644 --- a/shorewall-edit-html.lsp +++ b/shorewall-edit-html.lsp @@ -2,40 +2,8 @@ <html> <body> - <h1>Edit configuration</h1> -<? --[[ DEBUG INFORMATION...?> -<span style='color:#D2691E;font-family:courier;'>------------ START DEBUG INFORMATION ------------ -<h3>THIS VIEW CONTAINS THE FOLLOWING VARIABLES/TABLES</h2> -<? ---print ("<span style='color:darkblue;font-family:courier;'>") -for a,b in pairs(view) do - if not (type(b) == "table") then - print ("<b>" .. a .. "</b>: ><span2 style='color:black'>" .. b .. "</span2><<BR>") - else - print ("<b>" .. a .. "</b>:...<BR>") - for c,d in pairs(view[a]) do - if not (type(d) == "table") then - print ("<b> { " .. c .. "</b>: ><span2 style='color:black'>" .. d .. "</span2>< <B> }</B><BR>") - else - print ("<b> { " .. c .. "</b>:...<BR>") - for e,f in pairs(view[a][c]) do - if not (type(f) == "table") then - print ("<b> { { " .. e .. "</b>: ><span2 style='color:black'>" .. f .. "</span2>< <B> } }</B><BR>") - else - print ("<b> { { " .. e .. "</b>:... (table is not visible at the moment)<BR>") - end - end - end - end - end -a,b,c,d,e,f,g,h,i,j = nil,nil,nil,nil,nil,nil,nil,nil,nil,nil -end -print ("------------ END DEBUG INFORMATION ------------</span>") -?> -<? --]] ?> - <h2>Details</h2> <dt>File name</dt> @@ -55,6 +23,12 @@ print ("------------ END DEBUG INFORMATION ------------</span>") <input type="submit" name="cmd" value="update"><p class="error"><?= view.filecontent.errtxt ?></p></form> +<? +--[[ DEBUG INFORMATION +require("debugs") +io.write(debugs.variables(view)) +--]] +?> </body> </html> diff --git a/shorewall-model.lua b/shorewall-model.lua index ca26ca8..311ad86 100644 --- a/shorewall-model.lua +++ b/shorewall-model.lua @@ -23,7 +23,7 @@ end function check_config () check = nil check = {} - local f,err = io.popen("/etc/init.d/shorewall check") + local f,err = io.popen("/bin/echo -n '>> Check starts at: ';/bin/date; /bin/echo; /etc/init.d/shorewall check; /bin/echo; /bin/echo -n '>> Check stops at: '; /bin/date;") check.result = f:read("*a") f:close() check["error"]=err diff --git a/shorewall-read-html.lsp b/shorewall-read-html.lsp index 7f23c8f..5910c30 100644 --- a/shorewall-read-html.lsp +++ b/shorewall-read-html.lsp @@ -92,35 +92,9 @@ <dd><form action="xxx" method="POST"><input type=submit name="cmd" value="refresh" style="width:100px"></form> Involves black list, ECN control rules, and traffic shaping...</dd> --]] ?> - -<? --[[ DEBUG INFORMATION...?> -<span style='color:#D2691E;font-family:courier;'> -<h3>THIS VIEW CONTAINS THE FOLLOWING VARIABLES/TABLES</h2> ------------- START DEBUG INFORMATION ------------<BR> <? ---print ("<span style='color:darkblue;font-family:courier;'>") -for a,b in pairs(view) do - if not (type(b) == "table") then - print ("<b>" .. a .. "</b>: ><span2 style='color:black'>" .. b .. "</span2><<BR>") - else - print ("<b>" .. a .. "</b>:...<BR>") - for c,d in pairs(view[a]) do - if not (type(d) == "table") then - print ("<b> { " .. c .. "</b>: ><span2 style='color:black'>" .. d .. "</span2>< <B> }</B><BR>") - else - print ("<b> { " .. c .. "</b>:...<BR>") - for e,f in pairs(view[a][c]) do - if not (type(f) == "table") then - print ("<b> { { " .. e .. "</b>: ><span2 style='color:black'>" .. f .. "</span2>< <B> } }</B><BR>") - else - print ("<b> { { " .. e .. "</b>:... (table is not visible at the moment)<BR>") - end - end - end - end - end -a,b,c,d,e,f,g,h,i,j = nil,nil,nil,nil,nil,nil,nil,nil,nil,nil -end -print ("------------ END DEBUG INFORMATION ------------</span>") +--[[ DEBUG INFORMATION +require("debugs") +io.write(debugs.variables(view)) +--]] ?> -<? --]] ?> diff --git a/shorewall-restart-html.lsp b/shorewall-restart-html.lsp deleted file mode 100644 index 53d81b7..0000000 --- a/shorewall-restart-html.lsp +++ /dev/null @@ -1,71 +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><? - ---Status Block - for i,item in ipairs(view.note or {}) do - ?><p class='error'><?= item.content ?></p><? - end - -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/shorewall-stop-html.lsp b/shorewall-stop-html.lsp deleted file mode 100644 index 53d81b7..0000000 --- a/shorewall-stop-html.lsp +++ /dev/null @@ -1,71 +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><? - ---Status Block - for i,item in ipairs(view.note or {}) do - ?><p class='error'><?= item.content ?></p><? - end - -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 : -?> |