mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
cli: Add some error checks for ca target directory
This commit is contained in:
parent
ada3dab9d8
commit
f7183fd1ab
@ -469,6 +469,12 @@ def certidude_setup_authority(parent, country, state, locality, organization, or
|
|||||||
_, _, uid, gid, gecos, root, shell = pwd.getpwnam(group)
|
_, _, uid, gid, gecos, root, shell = pwd.getpwnam(group)
|
||||||
os.setgid(gid)
|
os.setgid(gid)
|
||||||
|
|
||||||
|
slug = os.path.basename(directory[:-1] if directory.endswith('/') else directory)
|
||||||
|
if not slug:
|
||||||
|
raise ValueError("Please supply proper target path")
|
||||||
|
|
||||||
|
click.echo("CA configuration files are saved to: {}".format(os.path.abspath(slug)))
|
||||||
|
|
||||||
click.echo("Generating 4096-bit RSA key...")
|
click.echo("Generating 4096-bit RSA key...")
|
||||||
|
|
||||||
if pkcs11:
|
if pkcs11:
|
||||||
@ -477,8 +483,6 @@ def certidude_setup_authority(parent, country, state, locality, organization, or
|
|||||||
key = crypto.PKey()
|
key = crypto.PKey()
|
||||||
key.generate_key(crypto.TYPE_RSA, 4096)
|
key.generate_key(crypto.TYPE_RSA, 4096)
|
||||||
|
|
||||||
slug = os.path.basename(directory)
|
|
||||||
|
|
||||||
if not crl_distribution_url:
|
if not crl_distribution_url:
|
||||||
crl_distribution_url = "http://%s/api/%s/revoked/" % (common_name, slug)
|
crl_distribution_url = "http://%s/api/%s/revoked/" % (common_name, slug)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user