PF-script stops if FQDN cannot be resolved

Leslie Jensen <[email protected]> Mon, 9 Mar 2015 17:16:50 +0100
Newsgroups gmane.os.openbsd.pf
Message-ID <CADtECiSOxFp7=HYo7_pKtk6Y8V9ke+Q6SDSZxDOZ4rQbzHoJpA@mail.gmail.com>
Hello list.

I have a problem with a simple script I've written to keep two tables up to
date. I have a few hosts I need to give access to my LAN via the table
goodguys. With these hosts being on a dynamic IP address I have to have
them registered via no-ip.

If the look up of FQDN for one of the hosts in my script fails the
remaining hosts and IP-addresses will not be added to the table goodguys.

I'm aware that this is a case of poor scripting and I would very much like
your feedback on how I can avoid an unknown host to make my script fail.

Thank you :-)

/Leslie


My script:

#!/bin/sh
#
#
pfctl -F Tables
#
#
pfctl -t goodguys -T add host1.no-ip.org host2.no-ip.org www.host3.nu
ipa.ddr.ess.002 ipa.ddr.ess.001
#
#
pfctl -t goodguys2 -T add ipa.ddr.ess.003 ipa.ddr.ess.004 ipa.ddr.ess.005
#
#
pfctl -T show -t goodguys
pfctl -T show -t goodguys2