When I start my desktop computer (not FreeBSD) it has a postfix instance to receive mail from my FreeBSD server machine which is always on. I want mail which is waiting to be delivered immediately so I can read it. I therefore have a start-up script in my desktop which knocks on a port in my server machine from a specific port on the desktop one.
The incoming postfix server on the FreeBSD machine runs in a jail, so I use pf to pass the knock on to the jail, and the jail uses a while loop running netcat to listen to the port and trigger a flush instruction to postfix.
After upgrading from 13.5-RELEASE to 15.0_RELEASE this has stopped working.
Here is the desktop script (with the ports munged):
Here is the pf rule on mainserver:
and here is the crontab entry to run netcat in the jail:
How do I go about tracking down where the packet is getting stuck?
The incoming postfix server on the FreeBSD machine runs in a jail, so I use pf to pass the knock on to the jail, and the jail uses a while loop running netcat to listen to the port and trigger a flush instruction to postfix.
After upgrading from 13.5-RELEASE to 15.0_RELEASE this has stopped working.
Here is the desktop script (with the ports munged):
Bash:
#!/bin/bash
# fetch_mail - sends port knock to server to flush mail queue.
sleep 10
touch /tmp/fetch_called
if /bin/ping -c 1 mainserver > /dev/null; then
/usr/bin/nc -zw 1 -p <nnnn> mainserver <mmmm>
echo "knocked on mainserver." > /tmp/fetch_called
elif /bin/ping -c 1 backupserver > /dev/null; then
/usr/bin/nc -zw 1 -p <nnnn> backupserver <mmmm>
echo "knocked on backupserver." > /tmp/fetch_called
else
echo "Neither machine could be reached." > /tmp/fetch_called
fi
Here is the pf rule on mainserver:
Code:
rdr pass on $ext_if inet proto tcp from $SSH_FROM_ADDR port <nnnn> to port <mmmm> -> $MAIL_IN_ADDR port <mmmm>
Code:
@reboot -n while true; do su -m postfix -c "netcat -lnzp <mmmm> 192.168.n.n <nnnn> && /u
sr/local/sbin/postqueue -f" ; done
How do I go about tracking down where the packet is getting stuck?