iptables and combining additional rule sources

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Fri Apr 24 23:06:54 EDT 2020

On Fri, 24 Apr 2020 18:28:21 -0400, Jeffrey Walton said:

> The problem I am having is, adding the new information to the existing
> iptables rules in /etc/sysconfig/iptables. I want to write my rules to
> a separate file and then tell /etc/sysconfig/iptables to include it at
> the correct position.
> I read the iptables(8), iptables-save(8) and iptables-restore(8) man
> pages, but I don't see how to combine the different sources.
> How do I tell iptables to include a second external source at a
> specific location?

Turn the problem on its side....

cat /etc/iptables.header /etc/iptables.newstuff /etc/iptables.trailer > /etc/sysconfig/iptables
iptables-restore < /etc/sysconfig/iptables

(basically the solution I did for an NFS server, where 'newstuff' and /etc/exports were
both machine-generated by a perl script that read a config file of authorized clients.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200424/d1145dec/attachment.sig>

More information about the Kernelnewbies mailing list