summaryrefslogtreecommitdiffstats
path: root/base/server/python/pki/server/cli
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-03-17 15:23:34 +0100
committerEndi S. Dewata <edewata@redhat.com>2016-04-02 07:48:04 +0200
commit9bd9548d5c1718ad8159f2134f170649c092a581 (patch)
tree0eacbafd403e00afe823c0fc3997cc7d1ffafc4e /base/server/python/pki/server/cli
parenta1de52ab41d0b0c9d5df4163224525ce940e91a8 (diff)
downloadpki-9bd9548d5c1718ad8159f2134f170649c092a581.tar.gz
pki-9bd9548d5c1718ad8159f2134f170649c092a581.tar.xz
pki-9bd9548d5c1718ad8159f2134f170649c092a581.zip
Additional clean-ups for PKCS #12 utilities.
The pki_server_external_cert_path has been renamed to pki_server_external_certs_path to match the file name. A default pki_server_external_certs_path has been added to default.cfg. The pki pkcs12-export has been modified to export into existing PKCS #12 file by default. The pki-server instance-cert-export has been modified to accept a list of nicknames to export. https://fedorahosted.org/pki/ticket/1742
Diffstat (limited to 'base/server/python/pki/server/cli')
-rw-r--r--base/server/python/pki/server/cli/instance.py11
-rw-r--r--base/server/python/pki/server/cli/subsystem.py4
2 files changed, 9 insertions, 6 deletions
diff --git a/base/server/python/pki/server/cli/instance.py b/base/server/python/pki/server/cli/instance.py
index 3119629e1..212a411cd 100644
--- a/base/server/python/pki/server/cli/instance.py
+++ b/base/server/python/pki/server/cli/instance.py
@@ -67,10 +67,10 @@ class InstanceCertExportCLI(pki.cli.CLI):
def __init__(self):
super(InstanceCertExportCLI, self).__init__(
- 'export', 'Export subsystem certificate')
+ 'export', 'Export system certificates')
def print_help(self): # flake8: noqa
- print('Usage: pki-server instance-cert-export [OPTIONS]')
+ print('Usage: pki-server instance-cert-export [OPTIONS] [nicknames...]')
print()
print(' -i, --instance <instance ID> Instance ID (default: pki-tomcat).')
print(' --pkcs12-file <path> Output file to store the exported certificate and key in PKCS #12 format.')
@@ -83,7 +83,7 @@ class InstanceCertExportCLI(pki.cli.CLI):
def execute(self, argv):
try:
- opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+ opts, args = getopt.gnu_getopt(argv, 'i:v', [
'instance=',
'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
'verbose', 'help'])
@@ -93,6 +93,8 @@ class InstanceCertExportCLI(pki.cli.CLI):
self.print_help()
sys.exit(1)
+ nicknames = args
+
instance_name = 'pki-tomcat'
pkcs12_file = None
pkcs12_password = None
@@ -139,7 +141,8 @@ class InstanceCertExportCLI(pki.cli.CLI):
nssdb.export_pkcs12(
pkcs12_file=pkcs12_file,
pkcs12_password=pkcs12_password,
- pkcs12_password_file=pkcs12_password_file)
+ pkcs12_password_file=pkcs12_password_file,
+ nicknames=nicknames)
finally:
nssdb.close()
diff --git a/base/server/python/pki/server/cli/subsystem.py b/base/server/python/pki/server/cli/subsystem.py
index 92d4c3deb..b6c694f88 100644
--- a/base/server/python/pki/server/cli/subsystem.py
+++ b/base/server/python/pki/server/cli/subsystem.py
@@ -576,9 +576,9 @@ class SubsystemCertExportCLI(pki.cli.CLI):
try:
nssdb.export_pkcs12(
pkcs12_file=pkcs12_file,
- nicknames=nicknames,
pkcs12_password=pkcs12_password,
- pkcs12_password_file=pkcs12_password_file)
+ pkcs12_password_file=pkcs12_password_file,
+ nicknames=nicknames)
finally:
nssdb.close()