mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
openvpn: When user certificate is empty, regenerate it
Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
This commit is contained in:
parent
4a3cf220c8
commit
fcd2499092
@ -164,7 +164,7 @@ def subcommand_get_profile(arguments):
|
|||||||
user_certificate = USER_CERTIFICATE_PATH.format(username=username)
|
user_certificate = USER_CERTIFICATE_PATH.format(username=username)
|
||||||
user_key = USER_KEY_PATH.format(username=username)
|
user_key = USER_KEY_PATH.format(username=username)
|
||||||
|
|
||||||
if not os.path.isfile(user_certificate) or not os.path.isfile(user_key):
|
if not _is_non_empty_file(user_certificate) or not os.path.isfile(user_key):
|
||||||
subprocess.check_call(['/usr/share/easy-rsa/pkitool', username],
|
subprocess.check_call(['/usr/share/easy-rsa/pkitool', username],
|
||||||
**COMMON_ARGS)
|
**COMMON_ARGS)
|
||||||
|
|
||||||
@ -185,6 +185,11 @@ def _read_file(filename):
|
|||||||
return ''.join(file_handle.readlines())
|
return ''.join(file_handle.readlines())
|
||||||
|
|
||||||
|
|
||||||
|
def _is_non_empty_file(filepath):
|
||||||
|
return os.path.isfile(filepath) and os.path.getsize(filepath) > 0
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Parse arguments and perform all duties."""
|
"""Parse arguments and perform all duties."""
|
||||||
arguments = parse_arguments()
|
arguments = parse_arguments()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user