From 95fd8c31f7b61fe9139752cebf4d70143e709319 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Tue, 5 Nov 2013 09:49:42 -0500
Subject: [PATCH] Renamed CLI commands.

The following commands have been renamed. The old commands will
no longer work.
* profile      -> ca-profile
* kraconnector -> ca-kraconnector

The following commands have also been renamed, but the old commands
will continue to work:
* cert        -> ca-cert
* key         -> kra-key

The user and group commands have already been renamed to <subsytem>-
user and <subsystem>-group. The old commands will continue to work
and will use CA subsystem by default.

Ticket #701
---
 base/java-tools/man/man1/pki.1                     | 67 +++++++++++-----------
 .../src/com/netscape/cmstools/cli/CACLI.java       |  4 ++
 .../src/com/netscape/cmstools/cli/KRACLI.java      |  2 +
 .../src/com/netscape/cmstools/cli/MainCLI.java     |  4 --
 .../python/pki/server/deployment/pkihelper.py      |  2 +-
 5 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/base/java-tools/man/man1/pki.1 b/base/java-tools/man/man1/pki.1
index 1f692e83df935b49b4ba93e4818d1f21bbcb2b50..966e2ee6f3930b7bbe9fc3d1d49c55a91eafb5cb 100644
--- a/base/java-tools/man/man1/pki.1
+++ b/base/java-tools/man/man1/pki.1
@@ -1,7 +1,7 @@
 .\" First parameter, NAME, should be all caps
 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
 .\" other parameters are allowed: see man(7), man(1)
-.TH pki 1 "December 13, 2012" "version 1.0" "PKI Command-Line Interface (CLI) Tools" Ade Lee
+.TH pki 1 "November 5, 2013" "version 10.1" "PKI Command-Line Interface (CLI) Tools" Ade Lee
 .\" Please adjust this date whenever revising the man page.
 .\"
 .\" Some roff macros, for reference:
@@ -47,11 +47,8 @@ Specifies the protocol (default: http).
 .B -p <port>
 Specifies the port (default: 8080).
 .TP
-.B -t <type>
-Specifies the type of subsystem (default: ca).
-.TP
-.B -U <uri>
-Specifies the server URI.
+.B -U <URL>
+Specifies the server URL.
 .TP
 .B -u <username>
 Specifies the username.
@@ -69,15 +66,15 @@ Specifies the user password.
 To view available commands and options, simply type \fBpki\fP.  Some commands have sub-commands. To view the sub-commands, type \fBpki <command>\fP.  To view each command's usage, type \fB pki <command> --help\fP.
 
 .SS Connection
-By default, \fBpki\fP connects to the non-secure (HTTP) port of a CA server running on localhost on port 8080.  To specify a different server location, use the appropriate arguements to give a different host (\fB-h\fP), port (\fB-p\fP), connection protocol  (\fB-P\fP), or subsystem type (\fB-t\fP).
+By default, the \fBpki\fP client connects to a server running on the localhost via the non-secure HTTP port 8080.  To specify a different server location, use the appropriate arguments to give a different host (\fB-h\fP), port (\fB-p\fP), or connection protocol (\fB-P\fP).
 
-.B pki -P <protocol> -h <hostname> -p <port> -t <subsystem> <command>
+.B pki -P <protocol> -h <hostname> -p <port> <command>
 
 Alternatively, the connection parameters can be specified as a URL:
 
-.B pki -U <subsystem URL> <command>
+.B pki -U <URL> <command>
 
-where the URL is of the format \fIhttps://<hostname>:<port>/<subsystem>\fP.
+where the URL is of the format \fI<protocol>://<hostname>:<port>\fP.
 
 .SS Authentication
 Some commands require authentication.  These are commands that are restricted to particular sets of users (such as agents or admins) or those operations involving certificate profiles that require authentication.
@@ -97,31 +94,31 @@ To authenticate with a client certificate:
 .SS Viewing Certificates
 Certificates can be viewed anonymously.
 
-To list all certificates:
+To list all certificates in the CA:
 
-.B pki cert-find
+.B pki ca-cert-find
 
-It is also possible to search for and list specific certificates by adding a search filter.  Use \fBpki cert-find --help\fP to see options.  For example, to search based on issuance date:
+It is also possible to search for and list specific certificates by adding a search filter.  Use \fBpki ca-cert-find --help\fP to see options.  For example, to search based on issuance date:
 
-.B pki cert-find --issuedOnFrom 2012-06-15
+.B pki ca-cert-find --issuedOnFrom 2012-06-15
 
 To view a particular certificate:
 
-.B pki cert-show <certificate ID>
+.B pki ca-cert-show <certificate ID>
 
 .SS Revoking Certificates
 Revoking, holding, or releasing a certificate must be executed as an agent user.
 To revoke a certificate:
 
-.B pki <agent authentication> cert-revoke <certificate ID>
+.B pki <agent authentication> ca-cert-revoke <certificate ID>
 
 To place a certificate on hold temporarily:
 
-.B pki <agent authentication> cert-hold <certificate ID>
+.B pki <agent authentication> ca-cert-hold <certificate ID>
 
 To release a certificate that has been placed on hold:
 
-.B pki <agent authentication> cert-release-hold <certificate ID>
+.B pki <agent authentication> ca-cert-release-hold <certificate ID>
 
 .SS Certificate Requests
 To request a certificate, first generate a certificate request in PKCS #10 or CRMF, and store this request in the XML template file, of the profile type the request relates to.
@@ -138,11 +135,11 @@ will store the XML template of the request in the specified output file.
 
 Then, fill in the values in the XML file and submit the request for review.  This can be done without authentication.
 
-.B pki cert-request-submit <request file>
+.B pki ca-cert-request-submit <request file>
 
 Then, an agent needs to review the request by running the following command:
 
-.B pki <agent authentication> cert-request-review <request ID> --file <file to store the certificate request>
+.B pki <agent authentication> ca-cert-request-review <request ID> --file <file to store the certificate request>
 
 The certificate request, as well as the defaults and constraints of the enrollment profile, will be stored in the output file provided by the --file option.  The agent can examine the file and override any values if necessary.  To process the request, enter the appropriate action when prompted:
 
@@ -150,34 +147,34 @@ The certificate request, as well as the defaults and constraints of the enrollme
 
 Alternatively, the agent can process the request in a single step with the following command:
 
-.B pki <agent authentication> cert-request-review <request ID> --action <action>
+.B pki <agent authentication> ca-cert-request-review <request ID> --action <action>
 
 .SS Group Management Commands
-All group commands must be executed as an administrator. Some representative commands are shown below.  Type \fBpki group\fP to get a list of additional commands.
+All group commands must be executed as the subsystem administrator. Type \fBpki <subsystem>-group\fP to view all group management commands for the subsystem.
 
-To list groups, use \fBpki group-find\fP.  It is possible to select the page size to limit the number of entries returned.  To list all groups:
+To list groups in CA, use \fBpki ca-group-find\fP.  It is possible to select the page size to limit the number of entries returned.  To list all groups:
 
-.B pki <admin authentication> group-find
+.B pki <admin authentication> ca-group-find
 
 To view a particular group:
 
-.B pki <admin authentication> group-show <group ID>
+.B pki <admin authentication> ca-group-show <group ID>
 
 To add a group:
 
-.B pki <admin authentication> group-add <group ID> --description "description"
+.B pki <admin authentication> ca-group-add <group ID> --description "description"
 
 To delete a group:
 
-.B pki <admin authentication> group-del <group ID>
+.B pki <admin authentication> ca-group-del <group ID>
 
 To add a user to a group:
 
-.B pki <admin authentication> group-member-add <group ID> <Member ID>
+.B pki <admin authentication> ca-group-member-add <group ID> <Member ID>
 
 To delete a user from a group:
 
-.B pki <admin authentication> group-member-del <group ID> <Member ID>
+.B pki <admin authentication> ca-group-member-del <group ID> <Member ID>
 
 .\".SS Key Management Commands
 .\"\fBpki\fP can be used with a KRA to find specific keys and key requests.  This will be documented in more detail at a later time.
@@ -194,23 +191,23 @@ To show the contents of the security domain:
 \fBpki <security domain admin authentication> securitydomain-show\fP
 
 .SS User Management Commands
-All user commands must be executed as an administrator. Some representative commands are shown below.  Type \fBpki user\fP to get a list of additional commands.
+All user commands must be executed as the subsystem administrator. Type \fBpki <subsystem>-user\fP to view all user management commands for the subsystem.
 
-To list users, use \fBpki user-find\fP.  It is possible to select the page size to limit the size of the results.  To list all users:
+To list users in CA, use \fBpki ca-user-find\fP.  It is possible to select the page size to limit the size of the results.  To list all users:
 
-.B pki <admin authentication> user-find
+.B pki <admin authentication> ca-user-find
 
 To view a particular user:
 
-.B pki <admin authentication> user-show <user ID>
+.B pki <admin authentication> ca-user-show <user ID>
 
 To add a user:
 
-.B pki <admin authentication> user-add <user ID> --fullName "<full name>"
+.B pki <admin authentication> ca-user-add <user ID> --fullName "<full name>"
 
 To delete a user:
 
-.B pki <admin authentication> user-del <user ID>
+.B pki <admin authentication> ca-user-del <user ID>
 
 .SH FILES
 .I /usr/bin/pki
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java b/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java
index 481be0330f7c3f0139b34eb446c5ee17062f6424..3cb456e5feddd6ca1bee312f21c9fc55269c5143 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/CACLI.java
@@ -23,7 +23,9 @@ import com.netscape.certsrv.client.Client;
 import com.netscape.cmstools.cert.CertCLI;
 import com.netscape.cmstools.group.GroupCLI;
 import com.netscape.cmstools.logging.AuditCLI;
+import com.netscape.cmstools.profile.ProfileCLI;
 import com.netscape.cmstools.selftests.SelfTestCLI;
+import com.netscape.cmstools.system.KRAConnectorCLI;
 import com.netscape.cmstools.user.UserCLI;
 
 /**
@@ -39,6 +41,8 @@ public class CACLI extends SubsystemCLI {
         addModule(new AuditCLI(this));
         addModule(new CertCLI(this));
         addModule(new GroupCLI(this));
+        addModule(new KRAConnectorCLI(this));
+        addModule(new ProfileCLI(this));
         addModule(new SelfTestCLI(this));
         addModule(new UserCLI(this));
     }
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java b/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java
index 7bed774737eb1ab69d1550205f8156697fc9f2b2..3c61cafe3ba7cd7692495886ec696b6075285d61 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/KRACLI.java
@@ -21,6 +21,7 @@ package com.netscape.cmstools.cli;
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.kra.KRAClient;
 import com.netscape.cmstools.group.GroupCLI;
+import com.netscape.cmstools.key.KeyCLI;
 import com.netscape.cmstools.logging.AuditCLI;
 import com.netscape.cmstools.selftests.SelfTestCLI;
 import com.netscape.cmstools.user.UserCLI;
@@ -37,6 +38,7 @@ public class KRACLI extends SubsystemCLI {
 
         addModule(new AuditCLI(this));
         addModule(new GroupCLI(this));
+        addModule(new KeyCLI(this));
         addModule(new SelfTestCLI(this));
         addModule(new UserCLI(this));
     }
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
index f77dc8183d144c1a84b48c693f03af41a808420f..5bf1a7a728a41ce4b7c919ffc138ce5c1dbb7f22 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
@@ -42,8 +42,6 @@ import com.netscape.cmstools.cert.CertCLI;
 import com.netscape.cmstools.client.ClientCLI;
 import com.netscape.cmstools.group.GroupCLI;
 import com.netscape.cmstools.key.KeyCLI;
-import com.netscape.cmstools.profile.ProfileCLI;
-import com.netscape.cmstools.system.KRAConnectorCLI;
 import com.netscape.cmstools.system.SecurityDomainCLI;
 import com.netscape.cmstools.user.UserCLI;
 
@@ -75,8 +73,6 @@ public class MainCLI extends CLI {
         addModule(new ProxyCLI(new CertCLI(this), "ca"));
         addModule(new ProxyCLI(new GroupCLI(this), "ca"));
         addModule(new ProxyCLI(new KeyCLI(this), "kra"));
-        addModule(new ProxyCLI(new KRAConnectorCLI(this), "ca"));
-        addModule(new ProxyCLI(new ProfileCLI(this), "ca"));
         addModule(new ProxyCLI(new SecurityDomainCLI(this), "ca"));
         addModule(new ProxyCLI(new UserCLI(this), "ca"));
     }
diff --git a/base/server/python/pki/server/deployment/pkihelper.py b/base/server/python/pki/server/deployment/pkihelper.py
index ad0acdbcecfdea7e7f45f37d975f6a6023430733..30ba87a72f3b49f587f40a4f77fbb651426f69d9 100644
--- a/base/server/python/pki/server/deployment/pkihelper.py
+++ b/base/server/python/pki/server/deployment/pkihelper.py
@@ -2623,7 +2623,7 @@ class KRAConnector:
                    "-P", "https",
                    "-d", self.master_dict['pki_database_path'],
                    "-c", token_pwd,
-                   "kraconnector-del", krahost, str(kraport)]
+                   "ca-kraconnector-del", krahost, str(kraport)]
 
         output = subprocess.check_output(command,
                                          stderr=subprocess.STDOUT,
-- 
1.8.1.4

