Просмотр исходного кода

Do not allow accidental opening traffic.

Prevent the user to open traffic from the world, accidentally, by not
explicitly specifying the source.
chiniforooshan 10 лет назад
Родитель
Сommit
a3e97b941b
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      cloudbridge/cloud/providers/gce/resources.py

+ 4 - 0
cloudbridge/cloud/providers/gce/resources.py

@@ -220,6 +220,10 @@ class GCEFirewallsDelegate(object):
         if self.find_firewall(tag, ip_protocol, port, source_range,
         if self.find_firewall(tag, ip_protocol, port, source_range,
                               source_tag) is not None:
                               source_tag) is not None:
             return True
             return True
+        # Do not let the user accidentally open traffic from the world by not
+        # explicitly specifying the source.
+        if source_tag is None and source_range is None:
+            return False
         firewall_number = 1
         firewall_number = 1
         suffixes = []
         suffixes = []
         for firewall in self.iter_firewalls(tag):
         for firewall in self.iter_firewalls(tag):