diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-09-26 21:05:40 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-09-26 21:06:10 +0200 |
| commit | 514dfbc9ba33dd1a18a3a891d1a7d23ce9e959ee (patch) | |
| tree | 5823c7551e164cd552c1ca4aa2010e7076bbc9c7 /python | |
| parent | d497c3b7a7504bb578874cc706dc75849ad84c2d (diff) | |
| download | vyos-1x-514dfbc9ba33dd1a18a3a891d1a7d23ce9e959ee.tar.gz vyos-1x-514dfbc9ba33dd1a18a3a891d1a7d23ce9e959ee.zip | |
configverify: T8859: remove dead code for verify_diffie_hellman_length()
Commit a9e9c4acfa ("pki: openvpn: T3642: Migrate OpenVPN to PKI and refactor")
was the last caller of verify_diffie_hellman_length() despite the build time
testcases.
Unused code is dead code, drop it.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/configverify.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 17476f02d..89f1b7ad7 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -423,43 +423,6 @@ def verify_vlan_config(config): verify_mtu_parent(c_vlan, s_vlan) verify_mtu_ipv6(c_vlan) - -def verify_diffie_hellman_length(file: str, min_keysize: int) -> bool: - """ Verify Diffie-Hellman keypair length given via file. It must be greater - than or equal to min_keysize. - - Raises TypeError if min_keysize is not an integer and ValueError if it is - not a positive integer - both indicate a logic error in the caller. An - unreadable or malformed file is user input, not a logic error, and simply - fails the check. """ - import os - import re - from vyos.utils.process import cmdl - - if isinstance(min_keysize, bool) or not isinstance(min_keysize, int): - raise TypeError( - f'min_keysize must be an integer, got {type(min_keysize).__name__}') - if min_keysize < 1: - raise ValueError( - f'min_keysize must be a positive integer, got {min_keysize}') - - if os.path.exists(file): - try: - out = cmdl( - ['openssl', 'dhparam', '-inform', 'PEM', '-in', file, '-text']) - except OSError: - # Not a readable PEM encoded Diffie-Hellman parameter file - return False - - prog = re.compile(r'\d+\s+bit') - match = prog.search(out) - if match: - bits = match[0].split()[0] - if int(bits) >= min_keysize: - return True - - return False - def verify_common_route_maps(config): """ Common helper function used by routing protocol implementations to perform |
