From 770cc205a0108be22922c46a39d162dc31c55724 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Sat, 19 May 2012 11:16:53 -0500 Subject: Added user CLI. The user CLI provides a tool to manage users and user certificates. Ticket #160 --- base/setup/CMakeLists.txt | 1 + base/setup/pki | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100755 base/setup/pki (limited to 'base/setup') diff --git a/base/setup/CMakeLists.txt b/base/setup/CMakeLists.txt index 05f18332d..54fe3b7f6 100644 --- a/base/setup/CMakeLists.txt +++ b/base/setup/CMakeLists.txt @@ -2,6 +2,7 @@ project(setup) install( FILES + pki pkicreate pkiremove pki-setup-proxy diff --git a/base/setup/pki b/base/setup/pki new file mode 100755 index 000000000..f4ab1a4fc --- /dev/null +++ b/base/setup/pki @@ -0,0 +1,106 @@ +#!/usr/bin/perl +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- + +############################################################################### +## (1) Specify variables used by this script. ## +############################################################################### + +my $PRODUCT="pki"; +my $libpath=""; + + +############################################################################### +## (2) Define helper functions. ## +############################################################################### + +sub invalid_architecture() +{ + print "\n"; + print "ERROR: pkisilent does not execute on this architecture\n"; + print "ERROR: check to make sure pki-native-tools package is installed!\n"; + print "\n"; +} + + +############################################################################### +## (3) Set the LD_LIBRARY_PATH environment variable ## +## (as well as the ${libpath} java property) to determine the ## +## search order this command uses to find shared libraries. ## +############################################################################### + +my $ARCHITECTURE=`uname -i`; +chop( $ARCHITECTURE ); + +if( $ARCHITECTURE eq "i386" ) { + $libpath="/usr/lib"; + + $ENV{LD_LIBRARY_PATH} = "/usr/lib/jss:" + . "/usr/lib:/lib"; +} elsif($ARCHITECTURE eq "x86_64") { + $libpath="/usr/lib64"; + + $ENV{LD_LIBRARY_PATH} = "/usr/lib64/jss:" + . "/usr/lib64:/lib64:" + . "/usr/lib/jss:" + . "/usr/lib:/lib"; +} else { + invalid_architecture(); + exit(255); +} + + +############################################################################### +## (4) Set the CP environment variable to determine the search ## +## order this command wrapper uses to find jar files. ## +############################################################################### + +$ENV{CLASSPATH} = "/usr/share/java/${PRODUCT}/pki-certsrv.jar:" + . "/usr/share/java/${PRODUCT}/pki-cms.jar:" + . "/usr/share/java/apache-commons-cli.jar:" + . "/usr/share/java/apache-commons-lang.jar:" + . "/usr/share/java/commons-httpclient.jar:" + . "/usr/share/java/httpcomponents/httpclient.jar:" + . "/usr/share/java/resteasy/jaxrs-api.jar:" + . "/usr/share/java/resteasy/resteasy-atom-provider.jar:" + . "/usr/share/java/resteasy/resteasy-jaxb-provider.jar:" + . "/usr/share/java/resteasy/resteasy-jaxrs.jar:" + . "/usr/share/java/servlet.jar:"; + +if( $ARCHITECTURE eq "x86_64" ) { + $ENV{CLASSPATH} = $ENV{CLASSPATH} + . "/usr/lib64/java/jss4.jar:" + . "/usr/lib/java/jss4.jar:"; +} else { + $ENV{CLASSPATH} = $ENV{CLASSPATH} + . "/usr/lib/java/jss4.jar:"; +} + + +############################################################################### +## (5) Execute the java command specified by this java command wrapper ## +## based upon the preset LD_LIBRARY_PATH and CP environment variables. ## +############################################################################### + +my @args = (); +foreach (@ARGV) { + push(@args, quotemeta($_)); +} + +system("java -cp $ENV{CLASSPATH} com.netscape.cms.client.cli.MainCLI @args"); -- cgit