diff options
author | kali <kali@leap.se> | 2013-05-01 04:41:11 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2013-05-11 21:59:58 +0900 |
commit | 544717da3e95a553fa2af8555df6b4e06d9e5af2 (patch) | |
tree | 17011789c37a22fc52c2451f3e806245b6fc2237 /src/leap/services/eip/eipconfig.py | |
parent | f74849f4c926a83190169cae570e9ec826fd46da (diff) |
sanitize ip address
Diffstat (limited to 'src/leap/services/eip/eipconfig.py')
-rw-r--r-- | src/leap/services/eip/eipconfig.py | 5 |
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, |