2019-11-14 05:50:42 +05:30
|
|
|
#!/bin/sh
|
2019-12-02 01:42:02 +05:30
|
|
|
# Test FWD between two syslogd, second binds 127.0.0.2:5555
|
2022-05-21 19:13:12 +05:30
|
|
|
# shellcheck disable=SC1090
|
|
|
|
|
2021-11-22 15:52:04 +05:30
|
|
|
if [ x"${srcdir}" = x ]; then
|
|
|
|
srcdir=.
|
|
|
|
fi
|
2021-11-22 19:46:05 +05:30
|
|
|
|
2022-05-21 19:13:12 +05:30
|
|
|
. ${srcdir}/lib.sh
|
2022-03-06 05:26:03 +05:30
|
|
|
setup -m0
|
2019-11-14 05:50:42 +05:30
|
|
|
|
2019-11-15 15:37:15 +05:30
|
|
|
MSG="fwd and allow"
|
2019-11-14 05:50:42 +05:30
|
|
|
|
2022-03-06 05:36:38 +05:30
|
|
|
cat <<EOF >"${CONFD}/fwd.conf"
|
2021-07-01 02:30:09 +05:30
|
|
|
kern.* /dev/null
|
|
|
|
ntp.* @127.0.0.2:${PORT2} ;RFC5424
|
2019-11-14 05:50:42 +05:30
|
|
|
EOF
|
|
|
|
|
2022-03-06 05:26:03 +05:30
|
|
|
reload
|
|
|
|
|
2022-03-06 05:36:38 +05:30
|
|
|
cat <<EOF >"${CONFD2}/50-default.conf"
|
2021-01-15 14:10:31 +05:30
|
|
|
kern.* /dev/null
|
2021-07-01 02:30:09 +05:30
|
|
|
*.*;kern.none ${LOG2} ;RFC5424
|
2019-11-14 05:50:42 +05:30
|
|
|
EOF
|
|
|
|
|
2022-03-06 05:26:03 +05:30
|
|
|
setup2 -m0 -a 127.0.0.2:* -b ":${PORT2}"
|
2019-11-14 05:50:42 +05:30
|
|
|
|
2022-03-06 05:32:03 +05:30
|
|
|
print "TEST: Starting"
|
2019-11-14 05:50:42 +05:30
|
|
|
|
2022-05-21 19:13:12 +05:30
|
|
|
logger -t fwd -p ntp.notice -m "NTP123" "${MSG}"
|
2022-03-06 05:37:31 +05:30
|
|
|
sleep 3 # Allow message to be received, processed, and forwarded
|
2022-03-06 05:36:38 +05:30
|
|
|
grep "fwd - NTP123 - ${MSG}" "${LOG2}" || FAIL "Nothing forwarded."
|
2022-03-06 05:32:03 +05:30
|
|
|
|
|
|
|
OK
|