Add 'show iptaccount' command

This commit is contained in:
Tom Eastep 2011-02-01 16:47:20 -08:00
parent 8b2ed47f58
commit 2ef674dc40
6 changed files with 96 additions and 12 deletions

View File

@ -6,6 +6,8 @@ Changes in Shorewall 4.4.17 RC 1
3) Tighten up the editing of ACCOUNT(...). 3) Tighten up the editing of ACCOUNT(...).
4) Add 'show ipaccount' command.
Changes in Shorewall 4.4.17 Beta 3 Changes in Shorewall 4.4.17 Beta 3
1) Allow run-time address variables in the masq file. 1) Allow run-time address variables in the masq file.

View File

@ -713,6 +713,12 @@ show_command() {
echo echo
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies; [ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies;
;; ;;
ipaccount)
echo "$g_product $SHOREWALL_VERSION per-IP Accounting at $g_hostname - $(date)"
echo
[ $# -gt 1 ] && usage 1
perip_accounting
;;
*) *)
if [ "$g_product" = Shorewall ]; then if [ "$g_product" = Shorewall ]; then
case $1 in case $1 in
@ -811,6 +817,27 @@ show_command() {
esac esac
} }
perip_accounting() {
if qt mywhich iptaccount; then
local hnames
local hname
hnames=$(iptaccount -a | grep '^Found table:' | cut -d ' ' -f 3)
if [ -n "$hnames" ]; then
for hname in $hnames; do
iptaccount -l $hname | egrep '^IP:|^Show'
echo
done
else
echo " No IP Accounting Tables Defined"
echo
fi
else
echo " iptaccount is not installed"
fi
}
# #
# Dump Filter - For Shorewall-lite, if there was a dumpfilter file at compile-time, # Dump Filter - For Shorewall-lite, if there was a dumpfilter file at compile-time,
# then the compiler generated another version of this function and # then the compiler generated another version of this function and
@ -947,6 +974,10 @@ do_dump_command() {
brctl show brctl show
fi fi
heading "Per-IP Counters"
perip_accounting
if qt mywhich setkey; then if qt mywhich setkey; then
heading "PFKEY SPD" heading "PFKEY SPD"
setkey -DP setkey -DP

View File

@ -79,6 +79,11 @@ Beta 1
I I I. N E W F E A T U R E S I N T H I S R E L E A S E I I I. N E W F E A T U R E S I N T H I S R E L E A S E
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
RC 1
1) A 'show ipaccount' command has been added to /sbin/shorewall. It
displays each per-IP accounting table.
Beta 3 Beta 3
1) This release adds support for per-IP accounting using the ACCOUNT 1) This release adds support for per-IP accounting using the ACCOUNT

View File

@ -1363,6 +1363,7 @@ usage() # $1 = exit status
echo " show dynamic <zone>" echo " show dynamic <zone>"
echo " show filters" echo " show filters"
echo " show ip" echo " show ip"
echo " show ipaccount"
echo " show [ -m ] log [<regex>]" echo " show [ -m ] log [<regex>]"
echo " show macro <macro>" echo " show macro <macro>"
echo " show macros" echo " show macros"

View File

@ -487,7 +487,7 @@
<arg choice="plain"><option>show</option></arg> <arg choice="plain"><option>show</option></arg>
<arg <arg
choice="req"><option>actions|classifiers|connections|config|filters|macros|zones</option></arg> choice="req"><option>actions|classifiers|connections|config|filters|ip|ipaccount|macros|zones</option></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
@ -1266,6 +1266,25 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">ip</emphasis></term>
<listitem>
<para>Displays the system's IPv4 configuration.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ipaccount</emphasis></term>
<listitem>
<para>Added in Shorewall 4.4.17. Displays the per-IP
accounting counters (<ulink
url="manpages/shorewall-accounting.html">shorewall-accounting</ulink>
(5)).</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">log</emphasis></term> <term><emphasis role="bold">log</emphasis></term>
@ -1337,6 +1356,14 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">routing</emphasis></term>
<listitem>
<para>Displays the system's IPv4 routing configuration.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">raw</emphasis></term> <term><emphasis role="bold">raw</emphasis></term>
@ -1480,12 +1507,13 @@
url="http://www.shorewall.net/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para> url="http://www.shorewall.net/starting_and_stopping_shorewall.htm">http://www.shorewall.net/starting_and_stopping_shorewall.htm</ulink></para>
<para>shorewall-accounting(5), shorewall-actions(5), <para>shorewall-accounting(5), shorewall-actions(5),
shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5), shorewall-ipsets(5), shorewall-blacklist(5), shorewall-hosts(5), shorewall_interfaces(5),
shorewall-maclist(5), shorewall-masq(5), shorewall-nat(5), shorewall-ipsets(5), shorewall-maclist(5), shorewall-masq(5),
shorewall-netmap(5), shorewall-params(5), shorewall-policy(5), shorewall-nat(5), shorewall-netmap(5), shorewall-params(5),
shorewall-providers(5), shorewall-proxyarp(5), shorewall-route_rules(5), shorewall-policy(5), shorewall-providers(5), shorewall-proxyarp(5),
shorewall-routestopped(5), shorewall-rules(5), shorewall.conf(5), shorewall-secmarks(5), shorewall-route_rules(5), shorewall-routestopped(5), shorewall-rules(5),
shorewall-tcclasses(5), shorewall-tcdevices(5), shorewall-tcrules(5), shorewall.conf(5), shorewall-secmarks(5), shorewall-tcclasses(5),
shorewall-tos(5), shorewall-tunnels(5), shorewall-zones(5)</para> shorewall-tcdevices(5), shorewall-tcrules(5), shorewall-tos(5),
shorewall-tunnels(5), shorewall-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@ -404,7 +404,7 @@
<arg choice="plain"><option>show</option></arg> <arg choice="plain"><option>show</option></arg>
<arg <arg
choice="req"><option>actions|classifiers|connections|config|filters|macros|zones</option></arg> choice="req"><option>actions|classifiers|connections|config|filters|ip|macros|zones</option></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
@ -1074,6 +1074,14 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">ip</emphasis></term>
<listitem>
<para>Displays the system's IPv6 configuration.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">log</emphasis></term> <term><emphasis role="bold">log</emphasis></term>
@ -1121,6 +1129,14 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">Routing</emphasis></term>
<listitem>
<para>Displays the system's IPv6 routing configuration.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">tc</emphasis></term> <term><emphasis role="bold">tc</emphasis></term>
@ -1245,8 +1261,9 @@
shorewall6-blacklist(5), shorewall6-hosts(5), shorewall6-interfaces(5), shorewall6-blacklist(5), shorewall6-hosts(5), shorewall6-interfaces(5),
shorewall6-maclist(5), shorewall6-params(5), shorewall6-policy(5), shorewall6-maclist(5), shorewall6-params(5), shorewall6-policy(5),
shorewall6-providers(5), shorewall6-route_rules(5), shorewall6-providers(5), shorewall6-route_rules(5),
shorewall6-routestopped(5), shorewall6-rules(5), shorewall6.conf(5), shorewall6-secmarks(5), shorewall6-routestopped(5), shorewall6-rules(5), shorewall6.conf(5),
shorewall6-tcclasses(5), shorewall6-tcdevices(5), shorewall6-tcrules(5), shorewall6-secmarks(5), shorewall6-tcclasses(5), shorewall6-tcdevices(5),
shorewall6-tos(5), shorewall6-tunnels(5), shorewall6-zones(5)</para> shorewall6-tcrules(5), shorewall6-tos(5), shorewall6-tunnels(5),
shorewall6-zones(5)</para>
</refsect1> </refsect1>
</refentry> </refentry>