0fcb1e
From f10d1a0f84ed0f16ab4a1469f16ffadb3e79e59e Mon Sep 17 00:00:00 2001
0fcb1e
From: Rob Crittenden <rcritten@redhat.com>
0fcb1e
Date: Fri, 27 Jan 2023 14:05:37 -0500
0fcb1e
Subject: [PATCH] doc: add the --run command for manual job execution
0fcb1e
0fcb1e
A manual method was mentioned with no specificity. Include
0fcb1e
the --run command. Also update the troubleshooting section
0fcb1e
to show what failure to restart the CA after configuration
0fcb1e
looks like.
0fcb1e
0fcb1e
Import the IPA CA chain for manual execution.
0fcb1e
0fcb1e
Also fix up some $ -> # to indicate root is needed.
0fcb1e
0fcb1e
Related: https://pagure.io/freeipa/issue/9294
0fcb1e
0fcb1e
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
0fcb1e
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
0fcb1e
---
0fcb1e
 doc/designs/expired_certificate_pruning.md | 46 +++++++++++++++-------
0fcb1e
 1 file changed, 32 insertions(+), 14 deletions(-)
0fcb1e
0fcb1e
diff --git a/doc/designs/expired_certificate_pruning.md b/doc/designs/expired_certificate_pruning.md
0fcb1e
index 2c10d914020d3c12b6abb028323cd6796ec33e00..a23e452696ba2a150c4ad5a3e57360ae0a16a338 100644
0fcb1e
--- a/doc/designs/expired_certificate_pruning.md
0fcb1e
+++ b/doc/designs/expired_certificate_pruning.md
0fcb1e
@@ -139,7 +139,7 @@ No validation of setting February 31st will be done. That will be left to PKI. B
0fcb1e
 
0fcb1e
 ### Disabling pruning
0fcb1e
 
0fcb1e
-`$ ipa-acme-manage pruning --enable=FALSE`
0fcb1e
+`# ipa-acme-manage pruning --enable=FALSE`
0fcb1e
 
0fcb1e
 This will remove the configuration option for `jobsScheduler.job.pruning.cron` just to be sure it no longer runs.
0fcb1e
 
0fcb1e
@@ -147,46 +147,46 @@ This will remove the configuration option for `jobsScheduler.job.pruning.cron` j
0fcb1e
 
0fcb1e
 #### Pruning certificates
0fcb1e
 
0fcb1e
-`$ ipa-acme-manage pruning --certretention=VALUE --certretentionunit=UNIT`
0fcb1e
+`# ipa-acme-manage pruning --certretention=VALUE --certretentionunit=UNIT`
0fcb1e
 
0fcb1e
 will be the equivalent of:
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.certRetentionTime 30`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.certRetentionTime 30`
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.certRetentionUnit day`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.certRetentionUnit day`
0fcb1e
 
0fcb1e
 The unit will always be required when modifying the time.
0fcb1e
 
0fcb1e
-`$ ipa-acme-manage pruning --certsearchsizelimit=VALUE --certsearchtimelimit=VALUE`
0fcb1e
+`# ipa-acme-manage pruning --certsearchsizelimit=VALUE --certsearchtimelimit=VALUE`
0fcb1e
 
0fcb1e
 will be the equivalent of:
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.certSearchSizeLimit 1000`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.certSearchSizeLimit 1000`
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.certSearchTimeLimit 0`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.certSearchTimeLimit 0`
0fcb1e
 
0fcb1e
 A value of 0 for searchtimelimit is unlimited.
0fcb1e
 
0fcb1e
 #### Pruning requests
0fcb1e
 
0fcb1e
-`$ ipa-acme-manage pruning --requestretention=VALUE --requestretentionunit=UNIT`
0fcb1e
+`# ipa-acme-manage pruning --requestretention=VALUE --requestretentionunit=UNIT`
0fcb1e
 
0fcb1e
 will be the equivalent of:
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.requestRetentionTime 30`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.requestRetentionTime 30`
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.requestRetentionUnit day`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.requestRetentionUnit day`
0fcb1e
 
0fcb1e
 The unit will always be required when modifying the time.
0fcb1e
 
0fcb1e
-`$ ipa-acme-manage pruning --requestsearchsizelimit=VALUE --requestsearchtimelimit=VALUE`
0fcb1e
+`# ipa-acme-manage pruning --requestsearchsizelimit=VALUE --requestsearchtimelimit=VALUE`
0fcb1e
 
0fcb1e
 
0fcb1e
 will be the equivalent of:
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.requestSearchSizeLimit 1000`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.requestSearchSizeLimit 1000`
0fcb1e
 
0fcb1e
-`$ pki-server ca-config-set jobsScheduler.job.pruning.requestSearchTimeLimit 0`
0fcb1e
+`# pki-server ca-config-set jobsScheduler.job.pruning.requestSearchTimeLimit 0`
0fcb1e
 
0fcb1e
 A value of 0 for searchtimelimit is unlimited.
0fcb1e
 
0fcb1e
@@ -212,10 +212,15 @@ Request search time limit: 0
0fcb1e
 Cron: 0 0 1 * *
0fcb1e
 ```
0fcb1e
 
0fcb1e
+### Manual pruning
0fcb1e
+
0fcb1e
+`# ipa-acme-manage pruning --run`
0fcb1e
+
0fcb1e
+This is useful for testing the configuration or if the user wants to use the system cron or systemd timers for handling automation.
0fcb1e
+
0fcb1e
 ## Implementation
0fcb1e
 
0fcb1e
 For online REST operations (login, run job) we will use the `ipaserver/plugins/dogtag.py::RestClient` class to manage the requests. This will take care of the authentication cookie, etc.
0fcb1e
-
0fcb1e
 The class uses dogtag.https_request() will can take PEM cert and key files as arguments. These will be used for authentication.
0fcb1e
 
0fcb1e
 For the non-REST operations (configuration, cron settings) the tool will fork out to pki-server ca-config-set.
0fcb1e
@@ -239,6 +244,7 @@ Overview of the CLI commands. Example:
0fcb1e
 | ipa-acme-manage pruning | --requestretention=30 --requestretentionunit=day |
0fcb1e
 | ipa-acme-manage pruning | --requestsearchsizelimit=1000 --requestsearchtimelimit=0 |
0fcb1e
 | ipa-acme-manage pruning | --config-show |
0fcb1e
+| ipa-acme-manage pruning | --run |
0fcb1e
 
0fcb1e
 ipa-acme-manage can only be run as root.
0fcb1e
 
0fcb1e
@@ -295,3 +301,15 @@ The PKI debug log will contain job information.
0fcb1e
 2022-12-08 21:15:24 [pruning] INFO: PruningJob: - filter: (&(!(requestState=complete))(requestModifyTime<=1667942124527)(!(requestModifyTime=1667942124527)))
0fcb1e
 2022-12-08 21:15:24 [pruning] INFO: LDAPSession: Searching ou=ca, ou=requests,o=ipaca for (&(!(requestState=complete))(dateOfModify<=20221108211524Z)(!(dateOfModify=20221108211524Z)))
0fcb1e
 ```
0fcb1e
+
0fcb1e
+### Manual execution fails with Forbidden
0fcb1e
+
0fcb1e
+If manually running pruning fails with a message like:
0fcb1e
+
0fcb1e
+```console
0fcb1e
+# ipa-acme-manage pruning --run
0fcb1e
+CalledProcessError(Command ['pki', '-C', '/tmp/tmppyyd3hfq/pwdfile.txt', '-d', '/tmp/tmppyyd3hfq', '-n', 'CN=IPA RA,O=EXAMPLE.TEST', 'ca-job-start', 'pruning'] returned non-zero exit status 255: 'PKIException: Forbidden\n')
0fcb1e
+The ipa-acme-manage command failed.
0fcb1e
+```
0fcb1e
+
0fcb1e
+You probably forgot to restart the CA after enabling pruning.
0fcb1e
-- 
0fcb1e
2.39.1
0fcb1e