diff options
author | Nataliia Solomko <natalirs1985@gmail.com> | 2024-08-17 13:26:51 +0300 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-18 06:04:58 +0000 |
commit | 2425aee523db48382a4c091163a8a5402b9949d2 (patch) | |
tree | 2591b281ff6c7cad994cddc40acb693c3d40a39d | |
parent | f2964b76521a43fd80a28e995155ac9f699e3c83 (diff) | |
download | vyos-1x-2425aee523db48382a4c091163a8a5402b9949d2.tar.gz vyos-1x-2425aee523db48382a4c091163a8a5402b9949d2.zip |
op_mode: T3961: Generate PKI expect 2 character country code
(cherry picked from commit 71d6d0fe31db13f4ddf5c75209b9bba88a1e0a32)
-rwxr-xr-x | src/op_mode/pki.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/op_mode/pki.py b/src/op_mode/pki.py index 9ce166c7d..615a458c9 100755 --- a/src/op_mode/pki.py +++ b/src/op_mode/pki.py @@ -316,7 +316,13 @@ def generate_certificate_request(private_key=None, key_type=None, return_request default_values = get_default_values() subject = {} - subject['country'] = ask_input('Enter country code:', default=default_values['country']) + while True: + country = ask_input('Enter country code:', default=default_values['country']) + if len(country) != 2: + print("Country name must be a 2 character country code") + continue + subject['country'] = country + break subject['state'] = ask_input('Enter state:', default=default_values['state']) subject['locality'] = ask_input('Enter locality:', default=default_values['locality']) subject['organization'] = ask_input('Enter organization name:', default=default_values['organization']) |