tools/ios_convert: add ServerDomainMask

Parses mobileconfig TLSTrustedServerNames
This commit is contained in:
James Prestwood 2019-08-26 16:34:20 -07:00 committed by Denis Kenzior
parent 96ce39c1c2
commit de2c808970
1 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class Network:
self.password = None
self.ssid = None
self.display_name = None
self.tls_trusted_servers = []
def process_eap_config(eap_conf, network):
for m in range(len(eap_conf)):
@ -34,6 +35,10 @@ def process_eap_config(eap_conf, network):
network.username = eap_conf[m + 1].text
elif eap_conf[m].text == "UserPassword" and args.passwd:
network.password = eap_conf[m + 1].text
elif eap_conf[m].text == "TLSTrustedServerNames":
tarray = eap_conf[m + 1]
for i in range(len(tarray)):
network.tls_trusted_servers.append(tarray[i].text)
def process_payload_array(parray):
network = Network()
@ -122,6 +127,11 @@ def write_network(network, root_ca_path):
output += "EAP-%s-Phase2-Password=%s\n" % \
(eap, network.password)
if len(network.tls_trusted_servers) > 0:
output += "EAP-%s-ServerDomainMask=" % eap
output += ';'.join(network.tls_trusted_servers)
output += '\n'
if network.display_name:
name = network.display_name
elif network.ssid: