summaryrefslogtreecommitdiff
path: root/src/op_mode/pki.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-18 09:40:50 +0200
committerGitHub <noreply@github.com>2024-08-18 09:40:50 +0200
commit0272bc92e70ae0e69cdd54f66a89921e2a98421c (patch)
tree2cf509a73958c79c66c561f2a0d4ad40767e42ab /src/op_mode/pki.py
parente79e74a494d9a1f2ead4433f2e0789fcb19dfb58 (diff)
parent2425aee523db48382a4c091163a8a5402b9949d2 (diff)
downloadvyos-1x-0272bc92e70ae0e69cdd54f66a89921e2a98421c.tar.gz
vyos-1x-0272bc92e70ae0e69cdd54f66a89921e2a98421c.zip
Merge pull request #3999 from vyos/mergify/bp/circinus/pr-3997
op_mode: T3961: Generate PKI expect 2 character country code (backport #3997)
Diffstat (limited to 'src/op_mode/pki.py')
-rwxr-xr-xsrc/op_mode/pki.py8
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'])