summaryrefslogtreecommitdiff
path: root/python/vyos/configverify.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-09-14 22:18:54 +0200
committerChristian Breunig <christian@breunig.cc>2024-09-14 22:50:20 +0200
commit0ee8d5e35044e7480dac6a23e92d43744b8c5d36 (patch)
tree3bd91642e78cbba66cda5ff633bb356f3c913974 /python/vyos/configverify.py
parent5df36ba0e3c95efb2962ed54e614552f7425e173 (diff)
downloadvyos-1x-0ee8d5e35044e7480dac6a23e92d43744b8c5d36.tar.gz
vyos-1x-0ee8d5e35044e7480dac6a23e92d43744b8c5d36.zip
ethernet: T6709: move EAPoL support to common framework
Instead of having EAPoL (Extensible Authentication Protocol over Local Area Network) support only available for ethernet interfaces, move this to common ground at vyos.ifconfig.interface making it available for all sorts of interfaces by simply including the XML portion #include <include/interface/eapol.xml.i>
Diffstat (limited to 'python/vyos/configverify.py')
-rw-r--r--python/vyos/configverify.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 59b67300d..92996f2ee 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -520,3 +520,20 @@ def verify_pki_dh_parameters(config: dict, dh_name: str, min_key_size: int=0):
dh_bits = dh_numbers.p.bit_length()
if dh_bits < min_key_size:
raise ConfigError(f'Minimum DH key-size is {min_key_size} bits!')
+
+def verify_eapol(config: dict):
+ """
+ Common helper function used by interface implementations to perform
+ recurring validation of EAPoL configuration.
+ """
+ if 'eapol' not in config:
+ return
+
+ if 'certificate' not in config['eapol']:
+ raise ConfigError('Certificate must be specified when using EAPoL!')
+
+ verify_pki_certificate(config, config['eapol']['certificate'], no_password_protected=True)
+
+ if 'ca_certificate' in config['eapol']:
+ for ca_cert in config['eapol']['ca_certificate']:
+ verify_pki_ca_certificate(config, ca_cert)