2

I want to copy the firewall configuration for iptables from one server to the other. Both servers run Debian Squeeze and have Webmin 1.660 installed, so I want to copy the configuration that Webmin uses.

I couldn´t find it in "/var/webmin", in "/etc/iptable*", "/etc/sysconfig/iptables", or in "iptables.up.rules".

"/var/lib/iptables/active" is the current configuration and when I edit it, those changes won´t show up in Webmin. Though, when I click on "Revert Configuration" my changes are lost in that file and replaced.

Which file do I have to copy?

Larsen
  • 315
  • 2
  • 14
  • 1
    You will probably have to load the new rules for iptables first in order to get them displayed in Webmin. Try editing /var/lib/iptables/active, issue an `iptables-restore < /var/lib/iptables/active` afterwards and check if Webmin noticed your edit. If this works, you can just copy the contents of the file to the other server, do an `iptables-restore` and you're done. – etagenklo Nov 22 '13 at 14:53
  • Just to clarify, the comments seem to indicate webmin does keep its own copy of iptables rules so you can't just change them using the command line. So the statement above 'webmin is just a frontend for various system files. It doesn't really "store" anything outside the actual config files' is not correct? – Ben Edwards May 08 '20 at 11:47

2 Answers2

1

Hmm, seems I must have done something wrong before, because you can simply replace "/var/lib/iptables/active" with the content or file you need and in Webmin click on the "Showing IPtable" button to have Webmin reload and display the new rules.

Larsen
  • 315
  • 2
  • 14
  • Yea, webmin is just a frontend for various system files. It doesn't really "store" anything outside the actual config files. – Satanicpuppy Nov 25 '13 at 13:27
0

Like @Satanicpuppy says in a comment: It doesn't really "store" anything outside the actual config file.

But! You can change the Webmin Module Config (see the link on top of the webmin "Linux Firewall" page). On this configuration page, there's a line "IPtables save file to edit". Change this from "Use operating system or Webmin default" to the second value where you can provide a path+filename (e.g. "/etc/webmin/firewall/iptables.save").

This file will be used and updated after you change settings in webmin.

You can also change settings in this file and activate these changes with

/etc/init.d/webmin-iptables start 
NilsB
  • 101
  • 1
  • 4