dimikot / vzfirewall

vzfirewall is an extremely simple tool to configure opened ports and hosts for incoming connections in OpenVZ environment
GNU Lesser General Public License v2.1
15 stars 6 forks source link

Skip .conf files with VE_TYPE="template" or no IP addresses #10

Open marl-scot opened 5 years ago

marl-scot commented 5 years ago

Hi, How would I edit the script to skip any conf files that have a config option of 'VE_TYPE="template"' or simply any containers without an IP address.

The issue is, that these do not contain any IP settings and vzfirewall bombs out if a contain hasn't got at least 1 IP address. The best option I think would be to just skip any conf files that don't have an IP address (or just issue a warning) rather than dying.

I know the issue is at line 214 in vzfirewall, but i am not sure how to get perl to just skip adding any rules for a container rather than dying. I thought that I could maybe just change the die statement to skip that iteration of the for loop, but I don't know enough perl (correction I don't know ANY perl, I use PHP) to skip the loop and not cause issues elsewhere in the script.

Thanks