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-01 04:41:11 +0900
commit2370950c7e2d15355daa95a01f20e77786da742e (patch)
tree48ca59704d3414321d87f4fe521dd90bdc5ecc97 /src/leap/services/eip/eipconfig.py
parent6acb92af4fef12ec0fad3741c58dee8ae3457d12 (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,