Add 'show action' command.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2017-01-19 15:58:18 -08:00
parent 9c3a82f628
commit 2a010f827b
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
2 changed files with 58 additions and 2 deletions

View File

@ -1150,6 +1150,11 @@ show_macros() {
done done
} }
show_an_action() {
echo "Shorewall $SHOREWALL_VERSION Action $1 at $g_hostname - $(date)"
cat ${directory}/action.$1
}
show_a_macro() { show_a_macro() {
echo "Shorewall $SHOREWALL_VERSION Macro $1 at $g_hostname - $(date)" echo "Shorewall $SHOREWALL_VERSION Macro $1 at $g_hostname - $(date)"
cat ${directory}/macro.$1 cat ${directory}/macro.$1
@ -1458,12 +1463,26 @@ show_command() {
;; ;;
*) *)
case $1 in case $1 in
action)
[ $# -lt 2 ] && fatal_error 'Missing <action>'
[ $# -gt 2 ] && too_many_arguments $2
for directory in $(split $CONFIG_PATH); do
if [ -f ${directory}/action.$2 ]; then
eval show_an_action $2 $g_pager
return
fi
done
echo " WARNING: Action $2 not found" >&2
return
;;
actions) actions)
[ $# -gt 1 ] && too_many_arguments $2 [ $# -gt 1 ] && too_many_arguments $2
eval show_actions_sorted $g_pager eval show_actions_sorted $g_pager
return return
;; ;;
macro) macro)
[ $# -lt 2 ] && fatal_error 'Missing <macro>'
[ $# -ne 2 ] && too_many_arguments $2 [ $# -ne 2 ] && too_many_arguments $2
for directory in $(split $CONFIG_PATH); do for directory in $(split $CONFIG_PATH); do
if [ -f ${directory}/macro.$2 ]; then if [ -f ${directory}/macro.$2 ]; then
@ -4291,6 +4310,7 @@ usage() # $1 = exit status
echo " savesets" echo " savesets"
echo " [ show | list | ls ] [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]" echo " [ show | list | ls ] [ -b ] [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
ecko " [ show | list | ls ] actions" ecko " [ show | list | ls ] actions"
ecko " [ show | list | ls ] action <action>"
echo " [ show | list | ls ] arptables" echo " [ show | list | ls ] arptables"
echo " [ show | list | ls ] [ -f ] capabilities" echo " [ show | list | ls ] [ -f ] capabilities"
echo " [ show | list | ls ] [ -x ] {bl|blacklists}" echo " [ show | list | ls ] [ -x ] {bl|blacklists}"

View File

@ -685,6 +685,31 @@
<arg choice="plain"><option>capabilities</option></arg> <arg choice="plain"><option>capabilities</option></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis>
<command>shorewall[6]</command>
<arg>options</arg>
<arg choice="req"><option>show | list | ls </option></arg>
<arg><option>-f</option></arg>
<arg choice="plain"><option>{actions|macros}</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>shorewall[6]</command>
<arg choice="opt"><option>trace</option>|<option>debug</option></arg>
<arg>options</arg>
<arg choice="req"><option>show | list | ls </option></arg>
<arg choice="plain"><option>action</option><arg
choice="plain"><replaceable>action</replaceable></arg></arg>
</cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>shorewall[6][-lite]</command> <command>shorewall[6][-lite]</command>
@ -695,7 +720,7 @@
<arg choice="req"><option>show | list | ls </option></arg> <arg choice="req"><option>show | list | ls </option></arg>
<arg <arg
choice="req"><option>actions|classifiers|connections|config|events|filters|ip|ipa|ipsec|macros|zones|policies|marks</option></arg> choice="req"><option>classifiers|connections|config|events|filters|ip|ipa|ipsec|zones|policies|marks</option></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
@ -2415,12 +2440,23 @@
arguments:</para> arguments:</para>
<variablelist> <variablelist>
<varlistentry>
<term><emphasis role="bold">action
<replaceable>action</replaceable></emphasis></term>
<listitem>
<para>Lists the named action file. Available on Shorewall and
Shorewall6 only.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">actions</emphasis></term> <term><emphasis role="bold">actions</emphasis></term>
<listitem> <listitem>
<para>Produces a report about the available actions (built-in, <para>Produces a report about the available actions (built-in,
standard and user-defined).</para> standard and user-defined). Available on Shorewall and
Shorewall6 only.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>