/usr/bin/pki is in pki-tools 10.2.6+git20160317-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #! /usr/bin/python
# Authors:
# Endi S. Dewata <edewata@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright (C) 2014 Red Hat, Inc.
# All rights reserved.
#
import shlex
import subprocess
import sys
def run_java_cli(args):
# read RESTEasy library path
value = subprocess.check_output(
'. /etc/pki/pki.conf && echo $RESTEASY_LIB',
shell=True)
resteasy_lib = str(value).strip()
# construct classpath
classpath = [
'/usr/share/java/commons-cli.jar',
'/usr/share/java/commons-codec.jar',
'/usr/share/java/commons-httpclient.jar',
'/usr/share/java/commons-io.jar',
'/usr/share/java/commons-lang.jar',
'/usr/share/java/commons-logging.jar',
'/usr/share/java/httpclient.jar',
'/usr/share/java/httpcore.jar',
'/usr/share/java/jackson-core-asl.jar',
'/usr/share/java/jackson-jaxrs.jar',
'/usr/share/java/jackson-mapper-asl.jar',
'/usr/share/java/jackson-mrbean.jar',
'/usr/share/java/jackson-smile.jar',
'/usr/share/java/jackson-xc.jar',
'/usr/share/java/jaxb-api.jar',
'/usr/share/java/ldapjdk.jar',
'/usr/share/java/servlet-api-3.0.jar',
resteasy_lib + '/jaxrs-api.jar',
resteasy_lib + '/resteasy-atom-provider.jar',
resteasy_lib + '/resteasy-client.jar',
resteasy_lib + '/resteasy-jaxb-provider.jar',
resteasy_lib + '/resteasy-jaxrs.jar',
resteasy_lib + '/resteasy-jaxrs-jandex.jar',
resteasy_lib + '/resteasy-jackson-provider.jar',
'/usr/share/java/pki/pki-nsutil.jar',
'/usr/share/java/pki/pki-cmsutil.jar',
'/usr/share/java/pki/pki-certsrv.jar',
'/usr/share/java/pki/pki-tools.jar',
'/usr/share/java/jss4.jar'
]
command = [
'java',
'-cp',
':'.join(classpath),
'com.netscape.cmstools.cli.MainCLI'
]
command.extend(args)
rv = subprocess.call(command)
exit(rv)
# pylint: disable=W0613
def run_python_cli(args):
raise Exception('Not implemented')
def main(argv):
# read global options
value = subprocess.check_output(
'. /etc/pki/pki.conf && echo $PKI_CLI_OPTIONS',
shell=True)
args = shlex.split(value.strip())
args.extend(argv[1:])
client_type = 'java'
new_args = []
# read --client-type parameter and remove it from the argument list
i = 0
while i < len(args):
if args[i] == '--client-type':
client_type = args[i + 1]
i = i + 1
else:
new_args.append(args[i])
i = i + 1
if client_type == 'java':
run_java_cli(new_args)
elif client_type == 'python':
run_python_cli(new_args)
else:
raise Exception('Unsupported client type: ' + client_type)
if __name__ == '__main__':
main(sys.argv)
|