summaryrefslogtreecommitdiff
path: root/src/leap/services/eip/eipconfig.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-05-01 04:41:11 +0900
committerkali <kali@leap.se>2013-05-11 21:59:58 +0900
commit544717da3e95a553fa2af8555df6b4e06d9e5af2 (patch)
tree17011789c37a22fc52c2451f3e806245b6fc2237 /src/leap/services/eip/eipconfig.py
parentf74849f4c926a83190169cae570e9ec826fd46da (diff)
sanitize ip address
Diffstat (limited to 'src/leap/services/eip/eipconfig.py')
-rw-r--r--src/leap/services/eip/eipconfig.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/leap/services/eip/eipconfig.py b/src/leap/services/eip/eipconfig.py
index baf26bca..e6b93647 100644
--- a/src/leap/services/eip/eipconfig.py
+++ b/src/leap/services/eip/eipconfig.py
@@ -36,6 +36,7 @@ class EIPConfig(BaseConfig):
"""
OPENVPN_ALLOWED_KEYS = ("auth", "cipher", "tls-cipher")
OPENVPN_CIPHERS_REGEX = re.compile("[A-Z0-9\-]+")
+ IP_REGEX = re.compile("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
def __init__(self):
BaseConfig.__init__(self)
@@ -90,7 +91,9 @@ class EIPConfig(BaseConfig):
index = 0
logger.warning("Provided an unknown gateway index %s, " +
"defaulting to 0")
- return gateways[0]["ip_address"]
+ ip_addr = gateways[0]["ip_address"]
+ if self.IP_REGEX.search(ip_addr):
+ return ip_addr
def get_client_cert_path(self,
providerconfig=None,