Skip to content

Commit

Permalink
Merge pull request vyos#3997 from natali-rs1985/T3961-current
Browse files Browse the repository at this point in the history
op_mode: T3961: Generate PKI expect 2 character country code
  • Loading branch information
c-po authored Aug 18, 2024
2 parents 94ace01 + 71d6d0f commit 26ebd3a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/op_mode/pki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 26ebd3a

Please sign in to comment.