summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-20 07:15:47 +0200
committerGitHub <noreply@github.com>2024-08-20 07:15:47 +0200
commit6cfa688699a2460becc27175c14263985ebfdfd0 (patch)
tree49237f93fd097bdc738f369297dd2d3043958a33 /src
parentf6c0fea07059f8543df1cb2fe8f8e53ffc0fc8db (diff)
parent424f2374a364537b9bd7941700fdf18edbb695bc (diff)
downloadvyos-1x-6cfa688699a2460becc27175c14263985ebfdfd0.tar.gz
vyos-1x-6cfa688699a2460becc27175c14263985ebfdfd0.zip
Merge pull request #3998 from vyos/mergify/bp/sagitta/pr-3997
op_mode: T3961: Generate PKI expect 2 character country code (backport #3997)
Diffstat (limited to 'src')
-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 57b97a47d..e26d51bad 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'])