[webmin-devel] Shorewall module checkin
Paul Gear <[email protected]> Mon, 22 Jun 2009 17:52:46 +1000
| Newsgroups | gmane.comp.web.webmin.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Jamie, I've just added the ability to create a shorewall dump to the shorewall module, but i'm having difficulty checking it into svn. The error message i get is: $ svn ci -m'Add ability to show a shorewall dump' svn: Commit failed (details follow): svn: Server sent unexpected return value (200 OK) in response to MKACTIVITY request for '/svn/webmin/!svn/act/ec2c5dec-9b7a-4c8b-acb4-20cd362a54b2' $ svn info Path: . URL: http://svn.webmin.com/svn/webmin/shorewall Repository Root: http://svn.webmin.com/svn/webmin Repository UUID: 4866884f-ef2d-0410-b9e6-f4f624169e46 Revision: 4885 Node Kind: directory Schedule: normal Last Changed Author: jcameron Last Changed Rev: 4713 Last Changed Date: 2009-05-24 16:17:47 +1000 (Sun, 24 May 2009) I suspect this might be an authentication or proxy issue (it's a while since i've worked on webmin), but i'm not sure. At any rate, my patch is attached. The functionality is a shameless rip-off of the existing status.cgi. (Under new versions of shorewall, "shorewall status" shows nothing of value when the verbosity is low.) I've given it rudimentary testing and it works for me, but the translations of the strings are obviously missing. Regards, Paul ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org - Forwarded by the Webmin development list at [email protected] To remove yourself from this list, go to http://lists.sourceforge.net/lists/listinfo/webadmin-devel
webmin-shorewall-dump.patch
(text/x-patch, 2.5 KB)
Index: dump.cgi
===================================================================
--- dump.cgi (revision 0)
+++ dump.cgi (revision 0)
@@ -0,0 +1,15 @@
+#!/usr/local/bin/perl
+# dump.cgi
+# Show a shorewall dump
+
+require './shorewall-lib.pl';
+&ui_print_header(undef, $text{'dump_title'}, "");
+print "<font size=-1><pre>";
+open(DUMP, "$config{'shorewall'} dump 2>&1 |");
+while(<DUMP>) {
+ print &html_escape($_);
+ }
+close(DUMP);
+print "</pre></font>\n";
+&ui_print_footer("", $text{'index_return'});
+
Property changes on: dump.cgi
___________________________________________________________________
Added: svn:executable
+ *
Index: lang/en
===================================================================
--- lang/en (revision 4885)
+++ lang/en (working copy)
@@ -15,6 +15,8 @@
index_stopdesc=Click this button to shut down Shorewall with the <tt>shorewall stop</tt> command. This will block access from all hosts except those in the When Stopped table.
index_status=Show Status
index_statusdesc=Click this button to view Shorewall's tables and rules from the <tt>shorewall status</tt> command.
+index_dump=Show Dump
+index_dumpdesc=Click this button to view Shorewall tracing information from the <tt>shorewall dump</tt> command.
index_check=Check Firewall
index_checkdesc=Click this button to have Shorewall validate your firewall configuration with the <tt>shorewall check</tt> command.
@@ -36,6 +38,7 @@
clear_err=Failed to clear firewall
stop_err=Failed to shut down firewall
status_title=Firewall Status
+dump_title=Firewall Dump
check_title=Check Firewall
check_ok=.. your firewall configuration looks OK.
check_failed=.. an error was found in your firewall configuration!
Index: index.cgi
===================================================================
--- index.cgi (revision 4885)
+++ index.cgi (working copy)
@@ -38,7 +38,7 @@
# chain in the filter table
print &ui_hr();
print "<table width=100%>\n";
- system("iptables -t filter -L shorewall -n >/dev/null 2>&1");
+ system("$config{'shorewall'} status 2>&1");
if ($?) {
# Down .. offer to start
# unless no permissions
@@ -90,6 +90,12 @@
print "<tr> <td><input type=submit ",
"value='$text{'index_check'}'></td>\n";
print "<td>$text{'index_checkdesc'}</td> </tr>\n";
+ print "</form>\n";
+ print "<form action=dump.cgi>\n";
+ print "<tr> <td><input type=submit ",
+ "value='$text{'index_dump'}'></td>\n";
+ print "<td>$text{'index_dumpdesc'}</td> </tr>\n";
+ print "</form>\n";
print "</table>\n";
}
}