Hi Jade,
the first thing I'd check is whether tacspooflog.pl is actually sending syslog packets (via strace) and that these packets arrive at the loopback interface (via tcpdump).
Cheers,
Marc
--
You received this message because you are subscribed to the Google Groups "Event-Driven Servers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-driven-ser...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/ba7df28a-ceb6-4fc9-92bf-1d5dbc655ae0n%40googlegroups.com.
Hi Jade,
could you please attach strace to one of the running
tacspooflog.pl Perl processes? That should indicate that a packet
was sent, see below.
Also, "tcpdump -ni lo port 514" should show that packet.
Thanks,
Marc
$ ps ax | grep tac
147481 pts/0 S+ 0:00 tac_plus-ng: 0 connections,
accepting up to 1920 more
147515 pts/0 S+ 0:00 sudo
/home/ubuntu/DEVEL/PROJECTS/tac_plus-ng/extra/tacspooflog.pl 1
147518 pts/2 Ss+ 0:00 sudo
/home/ubuntu/DEVEL/PROJECTS/tac_plus-ng/extra/tacspooflog.pl 1
147519 pts/2 S 0:00 perl
/home/ubuntu/DEVEL/PROJECTS/tac_plus-ng/extra/tacspooflog.pl 1
147534 pts/1 S+ 0:00 grep --color=auto tac
$ sudo strace -p 147519
strace: Process 147519 attached
read(0, "2023-08-14 18:31:49 +0200\t172.16"..., 8192) = 74
newfstatat(AT_FDCWD, "/etc/resolv.conf", {st_mode=S_IFREG|0644,
st_size=83, ...}, 0) = 0
newfstatat(AT_FDCWD, "/etc/resolv.conf", {st_mode=S_IFREG|0644,
st_size=83, ...}, 0) = 0
socket(AF_INET, SOCK_RAW, IPPROTO_RAW) = 3
setsockopt(3, SOL_IP, IP_HDRINCL, [1], 4) = 0
sendto(3,
"E\20\0L\0\0@\0@\21\16\222\254\20\0\356\177\0\0\1\270
\2\2\08\340 <38>"..., 76, 0, {sa_family=AF_INET,
sin_port=htons(514), sin_addr=inet_addr("127.0.0.1")}, 16) =
76
close(3) = 0
read(0, ^Cstrace: Process 147519 detached
<detached ...>
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/da9e0742-eecc-4ea8-940c-21afe85e0aa0n%40googlegroups.com.
Hi,
no, the assumption for input is that
$in =~ /^[^\t]+\t([^\t]+)\t(.*)$/ or $in =~ /\s+(\S+):\s+(.*)$/;
matches, and that the network device IP address can be found after the first tab or within a space-ip-colon sequence.
printf "whatever\t1.2.3.4\twhatever"|exec ...
likely works (untested).
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/5dd24227-0215-4041-8790-cdeb81f7fa1en%40googlegroups.com.
Hi Jade,
tacspooflog.pl is a Perl process, searching for "perl" should give a result. Or, just "ps ax | grep tac" as I showed in my example.
I've just run a quick test, and
$ printf "TEST\t10.10.10.10\tDATA"| sudo
strace -s 500 -e sendto -f ./tac_plus-ng/extra/tacspooflog.pl
127.0.0.1
sendto(3,
"E\20\0.\0\0@\0@\21\247\232\n\n\n\n\177\0\0\1\220;\2\2\0\32\325\262<38>tac_plus:
DATA", 46, 0, {sa_family=AF_INET, sin_port=htons(514),
sin_addr=inet_addr("127.0.0.1")}, 16) = 46
seems to work quite well (UDP packet, sent to port 514, with priority <38> prepended. Plus, as you've seen, tcpdump shows the packet, so everything looks fine. That <38> is LOG_AUTH (4 << 3) + LOG_INFO (6), so that looks quite well, too.
I think I've tested this years ago, ten years ago with rsyslogd. I just tried again, but, sadly, it doesn't seem to work any more.
I suspected some Linux reverse-path filtering to drop the packets, but disabling RPF doesn't seem to help.
I may or may not find the time to analyze this any further.
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/d0975005-e0ad-4607-a3b6-bbe994a52d54n%40googlegroups.com.
Hi Jade,
I think the packets sent by tacspooflog.pl never make it to the input queue of the local Linux system.
To work around this you can setup a network namespace with a veth
pair and reverse-path filtering disabled:
ip netns add spooflog
ip link add name spooflog0 type veth peer name spooflog1
ip link set spooflog1 netns spooflog
ip addr add 100.64.0.1/30 dev spooflog0
ip netns exec spooflog ip addr add 100.64.0.2/30 dev spooflog1
ip link set spooflog0 up
ip netns exec spooflog ip link set spooflog1 up
echo 0 > /proc/sys/net/ipv4/conf/spooflog0/rp_filter
Then run the script in that namespace:
destination = "|exec /usr/bin/ip netns
exec spooflog /path/to/tacspooflog.pl 100.64.0.1"
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/cb78138b-a573-4169-a47d-e6e1cf4f5f04n%40googlegroups.com.