ワークフロー実行 †
Workflowを実行する。例えば、証明書失効情報の作成などのWorkflowを実行することができる。
# openxpkicmd -h Usage: openxpkicmd [options] WORKFLOW_TYPE Options: --help brief help message --man full documentation --socketfile FILE OpenXPKI daemon socket file --realm REALM OpenXPKI realm --authstack STACK authentication stack to use (optional) --authuser USER authentication user (optional) --authpass PASS password for authentication user (optional) --param KEY=VALUE pass VALUE to WF parameter KEY (optional) Giving the same KEY more than once creates an array --dosplit Re-enable legacy behaviour to map mulitple params using --param KEY1=VAL1,KEY2=VAL2. Deprecared, please pass multiple --params instead. --wfid Pickup WF with this id at its current state --wfaction Execute action on exisiting workflow --debug enable debug mode --context show context data --attribute show attribute data --json dump data using json --json-pretty human readble json --timeout socket timeout in seconds (default 30s)
どのようなWorkflowがあるかは、以下を見れば大体わかる。
例えば、証明書失効情報の作成は、crl_issuance
である。
root@buster:/etc/openxpki/config.d/realm/democa/workflow/def# ls | sort ca_publish.yaml certificate_bulk_revoke.yaml certificate_enroll.yaml certificate_export.yaml certificate_privkey_export.yaml certificate_publishing.yaml certificate_revocation_request_v2.yaml certificate_revoke_by_entity.yaml certificate_search.yaml certificate_signing_request_v2.yaml change_metadata.yaml crl_issuance.yaml est_cacerts.yaml est_csrattrs.yaml notify_expiry.yaml report_full.yaml report_list.yaml report_summary.yaml request_checker.yaml search_scep_workflow.yaml set_motd.yaml show_metadata.yaml status_process.yaml status_system.yaml
証明書失効情報の作成は以下のとおり。
APIコマンドの実行 †
APIコマンドを実行する。
WebUIのリクエストもこのコマンド実行を行なっている。
# openxpkicli -h Usage: openxpkicli [options] command Options (all arguments are optional): --help brief help message --man full documentation --socketfile FILE OpenXPKI daemon socket file --instance NAME Shortcut to set socket on multi-instance configs --realm REALM OpenXPKI realm --authstack STACK authentication stack to use --authuser USER authentication user --authpass PASS password for authentication user --arg KEY=VALUE pass VALUE to method as parameter KEY --filearg KEY=FILE as --arg but read value from file name --param VALUE stack VALUE onto methods PARAMS array --param KEY=VALUE set VALUE in methods PARAMS hash using KEY --debug enable debug mode --timeout socket timeout in seconds (default 30s) --json activate json mode If active you can pass either a JSON string or a filename to read a json string from as second argument AFTER the command name. The parameters are merged with the other arguments. --json-pretty human readble json --session session mode, see below for details
どのようなコマンドがあるのかは、以下を見ればわかる。
URL https://github.com/openxpki/openxpki/tree/v3.5.9/core/server/OpenXPKI/Server/API2/Plugin
例 Workflowのヒストリ情報を取得 †
Workflowのhistoryを取得してみよう。
argは、コマンドに渡すパラメータである。
コマンドのAPI情報は以下から分かる。
# openxpkicli --realm democa --arg id=10239 get_workflow_history $VAR1 = { 'result' => [ { 'workflow_history_date' => '2020-07-04 11:25:23', 'workflow_state' => 'INITIAL', 'workflow_id' => 10239, 'workflow_action' => 'crl_initialize', 'workflow_description' => 'EXECUTE', 'workflow_user' => 'anonymous', 'workflow_hist_id' => 129535, 'workflow_node' => 'buster' }, { 'workflow_history_date' => '2020-07-04 11:25:24', 'workflow_id' => 10239, 'workflow_state' => 'CREATE_QUEUE', 'workflow_description' => 'AUTORUN', 'workflow_action' => 'crl_create_ca_list', 'workflow_user' => 'anonymous', 'workflow_hist_id' => 129791, 'workflow_node' => 'buster' }, { 'workflow_user' => 'anonymous', 'workflow_action' => 'global_noop', 'workflow_description' => 'AUTORUN', 'workflow_history_date' => '2020-07-04 11:25:24', 'workflow_id' => 10239, 'workflow_state' => 'LOAD_NEXT_CA', 'workflow_hist_id' => 130047, 'workflow_node' => 'buster' } ] };