Prechádzať zdrojové kódy

Make possible to define public interface name in firewall configuration

Emmanuel Bouthenot 6 rokov pred
rodič
commit
a9ed59047f

+ 1 - 0
roles/common/defaults/main.yml

@@ -40,6 +40,7 @@ with_ntp: True
 
 with_firewall: False
 firewall_debug: False
+firewall_interface: Null
 firewall_public:
   - 'ssh'
   - 'http'

+ 4 - 0
roles/common/templates/ferm/ferm.conf.j2

@@ -7,7 +7,11 @@
 #
 
 # Detecting network interface assiociated with default route
+{% if firewall_interface is defined and firewall_interface %}
+@def $NETDEV = {{ firewall_interface }};
+{% else %}
 @def $NETDEV = `ip route list | sed -r -n 's/^default\s+via\s+.*\s+dev\s+([a-z0-9]+).*$/\1/p'`;
+{% endif %}
 # Detecting list of bridge network interfaces
 @def $BRIDGES = `ip link show up | sed -r -n 's/^[0-9]:\s+((xen|)br[^:]+):\s+.*$/\1/p' | xargs`;