mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-08 16:54:10 +01:00
Apply the preceding change to Shorewall6
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
4415050fd2
commit
cd2056f0aa
@ -133,9 +133,9 @@ syslog_circular_buffer() {
|
|||||||
packet_log() # $1 = number of messages
|
packet_log() # $1 = number of messages
|
||||||
{
|
{
|
||||||
if [ -n "$g_showmacs" -o $VERBOSE -gt 2 ]; then
|
if [ -n "$g_showmacs" -o $VERBOSE -gt 2 ]; then
|
||||||
$LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
|
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/\[.*\] //' | sed s/" $host $LOGFORMAT"/" "/
|
||||||
else
|
else
|
||||||
$LOGREAD | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
|
$g_logread | grep 'IN=.* OUT=.*SRC=.*:.*DST=' | head -n$1 | tac | sed 's/ kernel://; s/MAC=.* SRC=/SRC=/; s/\[.*\] '// | sed s/" $host $LOGFORMAT"/" "/
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,10 +979,10 @@ hits_command() {
|
|||||||
|
|
||||||
timeout=30
|
timeout=30
|
||||||
|
|
||||||
if $LOGREAD | grep -q "${today}IN=.* OUT=" ; then
|
if $g_logread | grep -q "${today}IN=.* OUT=" ; then
|
||||||
echo " HITS IP DATE"
|
echo " HITS IP DATE"
|
||||||
echo " ---- --------------- ------"
|
echo " ---- --------------- ------"
|
||||||
$LOGREAD | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*SRC=\)\(.*\)\( DST=.*\)/\3 \1/' | sort | uniq -c | sort -rn | while read count address month day; do
|
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*SRC=\)\(.*\)\( DST=.*\)/\3 \1/' | sort | uniq -c | sort -rn | while read count address month day; do
|
||||||
printf '%7d %-15s %3s %2d\n' $count $address $month $day
|
printf '%7d %-15s %3s %2d\n' $count $address $month $day
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -990,7 +990,7 @@ hits_command() {
|
|||||||
|
|
||||||
echo " HITS IP PORT"
|
echo " HITS IP PORT"
|
||||||
echo " ---- --------------- -----"
|
echo " ---- --------------- -----"
|
||||||
$LOGREAD | grep "${today}IN=.* OUT=" | sed 's/\(.*SRC=\)\(.*\)\( DST=.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2 \4/
|
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.*SRC=\)\(.*\)\( DST=.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2 \4/
|
||||||
t
|
t
|
||||||
s/\(.*SRC=\)\(.*\)\( DST=.*\)/\2/' | sort | uniq -c | sort -rn | while read count address port; do
|
s/\(.*SRC=\)\(.*\)\( DST=.*\)/\2/' | sort | uniq -c | sort -rn | while read count address port; do
|
||||||
printf '%7d %-15s %d\n' $count $address $port
|
printf '%7d %-15s %d\n' $count $address $port
|
||||||
@ -1000,7 +1000,7 @@ hits_command() {
|
|||||||
|
|
||||||
echo " HITS DATE"
|
echo " HITS DATE"
|
||||||
echo " ---- ------"
|
echo " ---- ------"
|
||||||
$LOGREAD | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*\)/\1/' | sort | uniq -c | sort -rn | while read count month day; do
|
$g_logread | grep "${today}IN=.* OUT=" | sed 's/\(.\{6\}\)\(.*\)/\1/' | sort | uniq -c | sort -rn | while read count month day; do
|
||||||
printf '%7d %3s %2d\n' $count $month $day
|
printf '%7d %3s %2d\n' $count $month $day
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -1008,7 +1008,7 @@ hits_command() {
|
|||||||
|
|
||||||
echo " HITS PORT SERVICE(S)"
|
echo " HITS PORT SERVICE(S)"
|
||||||
echo " ---- ----- ----------"
|
echo " ---- ----- ----------"
|
||||||
$LOGREAD | grep "${today}IN=.* OUT=.*DPT" | sed 's/\(.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2/' | sort | uniq -c | sort -rn | while read count port ; do
|
$g_logread | grep "${today}IN=.* OUT=.*DPT" | sed 's/\(.*DPT=\)\([0-9]\{1,5\}\)\(.*\)/\2/' | sort | uniq -c | sort -rn | while read count port ; do
|
||||||
# List all services defined for the given port
|
# List all services defined for the given port
|
||||||
srv=$(grep "^[^#].*\\b$port/" /etc/services | cut -f 1 | cut -f 1 -d' ' | sort -u)
|
srv=$(grep "^[^#].*\\b$port/" /etc/services | cut -f 1 | cut -f 1 -d' ' | sort -u)
|
||||||
srv=$(echo $srv | sed 's/ /,/g')
|
srv=$(echo $srv | sed 's/ /,/g')
|
||||||
|
@ -72,9 +72,9 @@ get_config() {
|
|||||||
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
|
[ -z "$LOGFILE" ] && LOGFILE=/var/log/messages
|
||||||
|
|
||||||
if [ -n "$(syslog_circular_buffer)" ]; then
|
if [ -n "$(syslog_circular_buffer)" ]; then
|
||||||
LOGREAD="logread | tac"
|
g_logread="logread | tac"
|
||||||
elif [ -r $LOGFILE ]; then
|
elif [ -r $LOGFILE ]; then
|
||||||
LOGREAD="tac $LOGFILE"
|
g_logread="tac $LOGFILE"
|
||||||
else
|
else
|
||||||
echo "LOGFILE ($LOGFILE) does not exist!" >&2
|
echo "LOGFILE ($LOGFILE) does not exist!" >&2
|
||||||
exit 2
|
exit 2
|
||||||
|
Loading…
Reference in New Issue
Block a user