summaryrefslogtreecommitdiff
path: root/src/op_mode/pki.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-18 08:04:26 +0200
committerGitHub <noreply@github.com>2024-08-18 08:04:26 +0200
commit26ebd3af8cd2aa296621dbda11ac1c1e64514ba9 (patch)
tree53192384c9ef086cf0586400614fbedb24d9740b /src/op_mode/pki.py
parent94ace019c8d37f364abd46723fbbabcd8473cade (diff)
parent71d6d0fe31db13f4ddf5c75209b9bba88a1e0a32 (diff)
downloadvyos-1x-26ebd3af8cd2aa296621dbda11ac1c1e64514ba9.tar.gz
vyos-1x-26ebd3af8cd2aa296621dbda11ac1c1e64514ba9.zip
Merge pull request #3997 from natali-rs1985/T3961-current
op_mode: T3961: Generate PKI expect 2 character country code
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 84b080023..ea7e93931 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'])