Skip to content

Commit c15de71

Browse files
pandafynemesifier
authored andcommitted
[feature] Added support for more WPA EAP client parameters #313
Closes #313
1 parent 3617699 commit c15de71

4 files changed

Lines changed: 71 additions & 0 deletions

File tree

netjsonconfig/backends/openwrt/converters/wireless.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,16 @@ def __netjson_wifi_typecast(self, wifi):
283283
'vlan_bridge',
284284
'eap_type',
285285
'auth',
286+
'anonymous_identity',
286287
'identity',
287288
'password',
288289
'ca_cert',
289290
'client_cert',
291+
'ca_cert_usesystem',
292+
'subject_match',
293+
'altsubject_match',
294+
'domain_match',
295+
'domain_suffix_match',
290296
'priv_key',
291297
'priv_key_pwd',
292298
'wps_config',

netjsonconfig/backends/openwrt/schema.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,62 @@
900900
},
901901
}
902902
},
903+
"encryption_wpa_enterprise_sta_base_settings": {
904+
"properties": {
905+
"ca_cert_usesystem": {
906+
"title": "Use system certificates",
907+
"type": "boolean",
908+
"default": False,
909+
"format": "checkbox",
910+
"description": (
911+
'Validate server certificate using built-in'
912+
' system CA bundle, requires the "ca-bundle" package'
913+
),
914+
"propertyOrder": 7.9,
915+
},
916+
"subject_match": {
917+
"title": "Certificate constraint (Subject)",
918+
"type": "string",
919+
"description": (
920+
"Certificate constraint substring"
921+
" - e.g. /CN=wifi.mycompany.com See `logread -f` during"
922+
" handshake for actual values"
923+
),
924+
"propertyOrder": 8.9,
925+
},
926+
"altsubject_match": {
927+
"title": "Certificate constraint (SAN)",
928+
"description": (
929+
"Certificate constraint(s) via Subject Alternate"
930+
" Name values (supported attributes: EMAIL, DNS, URI)"
931+
" - e.g. DNS:wifi.mycompany.com"
932+
),
933+
"type": "array",
934+
"items": {"type": "string"},
935+
"propertyOrder": 8.91,
936+
},
937+
"domain_match": {
938+
"title": "Certificate constraint (Domain)",
939+
"description": (
940+
"Certificate constraint(s) against DNS SAN values"
941+
" (if available) or Subject CN (exact match)"
942+
),
943+
"type": "array",
944+
"items": {"type": "string"},
945+
"propertyOrder": 8.92,
946+
},
947+
"domain_suffix_match": {
948+
"title": "Certificate constraint (Wildcard)",
949+
"description": (
950+
"Certificate constraint(s) against DNS SAN values "
951+
"(if available) or Subject CN (suffix match)"
952+
),
953+
"type": "array",
954+
"items": {"type": "string"},
955+
"propertyOrder": 8.93,
956+
},
957+
}
958+
},
903959
},
904960
"properties": {
905961
"general": {

netjsonconfig/schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@
662662
"propertyOrder": 5,
663663
},
664664
"identity": {"type": "string", "propertyOrder": 6},
665+
"anonymous_identity": {"type": "string", "propertyOrder": 6.1},
665666
"password": {"type": "string", "propertyOrder": 7},
666667
"ca_cert": {
667668
"type": "string",

tests/openwrt/test_encryption.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,12 @@ def test_parse_wpa2_enterprise_client(self):
563563
"cipher": "auto",
564564
"eap_type": "ttls",
565565
"auth": "MSCHAPV2",
566+
"anonymous_identity": "anonymous",
566567
"identity": "test-identity",
567568
"password": "test-password",
569+
"client_cert": "/etc/ssl/wifi.openwisp.io/cert.crt",
570+
"priv_key": "/etc/ssl/wifi.openwisp.io/private.key",
571+
"domain_match": ["wifi.openwisp.io"],
568572
},
569573
},
570574
}
@@ -573,15 +577,19 @@ def test_parse_wpa2_enterprise_client(self):
573577
_wpa2_enterprise_ttls_client_uci = """package wireless
574578
575579
config wifi-iface 'wifi_wlan0'
580+
option anonymous_identity 'anonymous'
576581
option auth 'MSCHAPV2'
577582
option bssid '00:26:b9:20:5f:09'
583+
option client_cert '/etc/ssl/wifi.openwisp.io/cert.crt'
578584
option device 'radio0'
585+
list domain_match 'wifi.openwisp.io'
579586
option eap_type 'ttls'
580587
option encryption 'wpa2'
581588
option identity 'test-identity'
582589
option ifname 'wlan0'
583590
option mode 'sta'
584591
option password 'test-password'
592+
option priv_key '/etc/ssl/wifi.openwisp.io/private.key'
585593
option ssid 'enterprise-client'
586594
"""
587595

0 commit comments

Comments
 (0)