Blame SOURCES/1001-Remove-rekey-feature.patch

7a8c6d
From 3c763332adc224d0e325502cb3e5b97d4155bb0c Mon Sep 17 00:00:00 2001
7a8c6d
From: Jan Cholasta <jcholast@redhat.com>
7a8c6d
Date: Fri, 7 Aug 2015 13:40:41 +0200
7a8c6d
Subject: [PATCH] Remove rekey feature
7a8c6d
7a8c6d
https://bugzilla.redhat.com/show_bug.cgi?id=1250397
7a8c6d
---
7a8c6d
 src/certmonger-scep-submit.8.in |  8 --------
7a8c6d
 src/certmonger.conf.5.in        | 19 -------------------
7a8c6d
 src/getcert-add-scep-ca.1.in    |  8 --------
7a8c6d
 src/getcert.c                   |  3 ---
7a8c6d
 src/prefs.c                     | 27 +--------------------------
7a8c6d
 src/scep.c                      |  5 -----
7a8c6d
 src/submit-e.c                  |  6 ------
7a8c6d
 src/tdbush.c                    | 10 +---------
7a8c6d
 tests/010-iterate/expected.out  | 14 +++++---------
7a8c6d
 tests/028-dbus/expected.out     |  6 ------
7a8c6d
 tests/036-getcert/expected.out  | 26 ++++++++++++++------------
7a8c6d
 tests/037-rekey2/expected.out   |  4 ++--
7a8c6d
 12 files changed, 23 insertions(+), 113 deletions(-)
7a8c6d
7a8c6d
diff --git a/src/certmonger-scep-submit.8.in b/src/certmonger-scep-submit.8.in
7a8c6d
index 7319c6a..31203c3 100644
7a8c6d
--- a/src/certmonger-scep-submit.8.in
7a8c6d
+++ b/src/certmonger-scep-submit.8.in
7a8c6d
@@ -80,14 +80,6 @@ When called with the \fB-c\fR or \fB-C\fR flag, this option can be used to
7a8c6d
 specify the CA identifier which is passed to the server as part of the client's
7a8c6d
 request.  The default is "0".
7a8c6d
 .TP
7a8c6d
-\fB\-n\fR
7a8c6d
-The SCEP Renewal feature allows a client with a previously-issued certificate
7a8c6d
-to use that certificate and the associated private key to request a new
7a8c6d
-certificate for a different key pair, and can be used to support
7a8c6d
-\fIcertmonger\fR's rekeying feature if the SCEP server advertises support for
7a8c6d
-it.  This option forces the \fIscep-submit\fR helper to prefer to issue
7a8c6d
-requests which do not make use of this feature.
7a8c6d
-.TP
7a8c6d
 \fB-v\fR
7a8c6d
 Increases the logging level.  Use twice for more logging.  This option
7a8c6d
 is mainly useful for troubleshooting.
7a8c6d
diff --git a/src/certmonger.conf.5.in b/src/certmonger.conf.5.in
7a8c6d
index 241f48b..e1220f1 100644
7a8c6d
--- a/src/certmonger.conf.5.in
7a8c6d
+++ b/src/certmonger.conf.5.in
7a8c6d
@@ -72,25 +72,6 @@ These are the trust attributes which are applied to certificates which are not
7a8c6d
 necessarily to be trusted, when they are saved to NSS databases.  The default
7a8c6d
 is \fI,,\fP.
7a8c6d
 
7a8c6d
-.IP max_key_use_count
7a8c6d
-When attempting to replace a certificate, if \fIcertmonger\fR has previously
7a8c6d
-obtained at least this number of certificates using the current key pair, it
7a8c6d
-will generate a new key pair to use before proceeding.  There is effectively no
7a8c6d
-default for this setting.
7a8c6d
-
7a8c6d
-.IP max_key_lifetime
7a8c6d
-The amount of time after a key was first generated when \fIcertmonger\fR will
7a8c6d
-attempt to generate a new key pair to replace it, as part of the process of
7a8c6d
-replacing a certificate.
7a8c6d
-The value is specified as a combination of years (y), months (M), weeks (w),
7a8c6d
-days (d), hours (h), minutes (m), and/or seconds (s).  If no unit of time is
7a8c6d
-specified, seconds are assumed.
7a8c6d
-The date when a key was generated is not recorded if the key was not generated
7a8c6d
-by \fIcertmonger\fR, or if the key was generated with a version of
7a8c6d
-\fIcertmonger\fR older than 0.78, and for those cases, this option has no
7a8c6d
-effect.
7a8c6d
-There is effectively no default for this setting.
7a8c6d
-
7a8c6d
 .SH SELFSIGN
7a8c6d
 Within the \fIselfsign\fR section, these variables and values are recognized:
7a8c6d
 
7a8c6d
diff --git a/src/getcert-add-scep-ca.1.in b/src/getcert-add-scep-ca.1.in
7a8c6d
index f07b900..64f0f5e 100644
7a8c6d
--- a/src/getcert-add-scep-ca.1.in
7a8c6d
+++ b/src/getcert-add-scep-ca.1.in
7a8c6d
@@ -46,14 +46,6 @@ A CA identifier value which will passed to the server when the
7a8c6d
 \fIscep-submit\fR helper is used to retrieve copies of the server's
7a8c6d
 certificates.
7a8c6d
 .TP
7a8c6d
-\fB\-n\fR
7a8c6d
-The SCEP Renewal feature allows a client with a previously-issued certificate
7a8c6d
-to use that certificate and the associated private key to request a new
7a8c6d
-certificate for a different key pair, and can be used to support
7a8c6d
-\fIcertmonger\fR's rekeying feature if the SCEP server advertises support for
7a8c6d
-it.  This option forces the \fIscep-submit\fR helper to issue requests without
7a8c6d
-making use of this feature.
7a8c6d
-.TP
7a8c6d
 \fB\-v\fR
7a8c6d
 Be verbose about errors.  Normally, the details of an error received from
7a8c6d
 the daemon will be suppressed if the client can make a diagnostic suggestion.
7a8c6d
diff --git a/src/getcert.c b/src/getcert.c
7a8c6d
index 26a88f3..966ff41 100644
7a8c6d
--- a/src/getcert.c
7a8c6d
+++ b/src/getcert.c
7a8c6d
@@ -4663,7 +4663,6 @@ static struct {
7a8c6d
 	{"start-tracking", start_tracking},
7a8c6d
 	{"stop-tracking", stop_tracking},
7a8c6d
 	{"resubmit", resubmit},
7a8c6d
-	{"rekey", rekey},
7a8c6d
 	{"refresh", refresh},
7a8c6d
 	{"list", list},
7a8c6d
 	{"status", status},
7a8c6d
@@ -5087,8 +5086,6 @@ help(const char *twopartcmd, const char *category)
7a8c6d
 		 N_("stop monitoring a certificate\n")},
7a8c6d
 		{"resubmit", resubmit_help,
7a8c6d
 		 N_("resubmit an in-progress enrollment request, or start a new one\n")},
7a8c6d
-		{"rekey", rekey_help,
7a8c6d
-		 N_("generate a new private key and replace a certificate\n")},
7a8c6d
 		{"refresh", refresh_help,
7a8c6d
 		 N_("check on the status of an in-progress enrollment request\n")},
7a8c6d
 		{"list", list_help,
7a8c6d
diff --git a/src/prefs.c b/src/prefs.c
7a8c6d
index ab363bb..0a8e166 100644
7a8c6d
--- a/src/prefs.c
7a8c6d
+++ b/src/prefs.c
7a8c6d
@@ -545,36 +545,11 @@ cm_prefs_nss_other_trust(void)
7a8c6d
 long long
7a8c6d
 prefs_key_end_of_life(time_t ref)
7a8c6d
 {
7a8c6d
-	const char *cfg;
7a8c6d
-	time_t tmp;
7a8c6d
-
7a8c6d
-	tmp = -1;
7a8c6d
-	cfg = cm_prefs_config(NULL, "max_key_lifetime");
7a8c6d
-	if (cfg != NULL) {
7a8c6d
-		if (cm_submit_u_delta_from_string(cfg, ref, &tmp) == 0) {
7a8c6d
-			return tmp;
7a8c6d
-		}
7a8c6d
-	}
7a8c6d
 	return -1;
7a8c6d
 }
7a8c6d
 
7a8c6d
 long
7a8c6d
 prefs_max_key_use_count(void)
7a8c6d
 {
7a8c6d
-	static long count = -2;
7a8c6d
-	long tmp;
7a8c6d
-	const char *cfg;
7a8c6d
-	char *p;
7a8c6d
-
7a8c6d
-	if (count == -2) {
7a8c6d
-		count = -1;
7a8c6d
-		cfg = cm_prefs_config(NULL, "max_key_use_count");
7a8c6d
-		if (cfg != NULL) {
7a8c6d
-			tmp = strtol(cfg, &p, 10);
7a8c6d
-			if ((p != NULL) && (*p == '\0')) {
7a8c6d
-				count = tmp;
7a8c6d
-			}
7a8c6d
-		}
7a8c6d
-	}
7a8c6d
-	return count;
7a8c6d
+	return -1;
7a8c6d
 }
7a8c6d
diff --git a/src/scep.c b/src/scep.c
7a8c6d
index d3bbc05..11f9ae3 100644
7a8c6d
--- a/src/scep.c
7a8c6d
+++ b/src/scep.c
7a8c6d
@@ -231,7 +231,6 @@ main(int argc, const char **argv)
7a8c6d
 		{"racert", 'r', POPT_ARG_STRING, NULL, 'r', "the RA certificate, used for encrypting requests", "FILENAME"},
7a8c6d
 		{"cacert", 'R', POPT_ARG_STRING, NULL, 'R', "the CA certificate, used for verifying responses", "FILENAME"},
7a8c6d
 		{"other-certs", 'I', POPT_ARG_STRING, NULL, 'I', "additional certificates", "FILENAME"},
7a8c6d
-		{"non-renewal", 'n', POPT_ARG_NONE, &prefer_non_renewal, 0, "prefer to not use the SCEP Renewal feature", NULL},
7a8c6d
 		{"verbose", 'v', POPT_ARG_NONE, NULL, 'v', NULL, NULL},
7a8c6d
 		POPT_AUTOHELP
7a8c6d
 		POPT_TABLEEND
7a8c6d
@@ -255,8 +254,6 @@ main(int argc, const char **argv)
7a8c6d
 			message = getenv(CM_SUBMIT_SCEP_PKCSREQ_REKEY_ENV);
7a8c6d
 			if (message == NULL) {
7a8c6d
 				message = getenv(CM_SUBMIT_SCEP_PKCSREQ_ENV);
7a8c6d
-			} else {
7a8c6d
-				rekey_message = getenv(CM_SUBMIT_SCEP_PKCSREQ_ENV);
7a8c6d
 			}
7a8c6d
 		} else
7a8c6d
 		if (strcasecmp(mode, CM_OP_POLL) == 0) {
7a8c6d
@@ -264,8 +261,6 @@ main(int argc, const char **argv)
7a8c6d
 			message = getenv(CM_SUBMIT_SCEP_PKCSREQ_REKEY_ENV);
7a8c6d
 			if (message == NULL) {
7a8c6d
 				message = getenv(CM_SUBMIT_SCEP_PKCSREQ_ENV);
7a8c6d
-			} else {
7a8c6d
-				rekey_message = getenv(CM_SUBMIT_SCEP_PKCSREQ_ENV);
7a8c6d
 			}
7a8c6d
 		} else
7a8c6d
 		if (strcasecmp(mode, CM_OP_FETCH_SCEP_CA_CERTS) == 0) {
7a8c6d
diff --git a/src/submit-e.c b/src/submit-e.c
7a8c6d
index befd01e..af05efe 100644
7a8c6d
--- a/src/submit-e.c
7a8c6d
+++ b/src/submit-e.c
7a8c6d
@@ -446,12 +446,6 @@ cm_submit_e_need_scep_messages(struct cm_submit_state *state)
7a8c6d
 static int
7a8c6d
 cm_submit_e_need_rekey(struct cm_submit_state *state)
7a8c6d
 {
7a8c6d
-	int status;
7a8c6d
-	status = cm_subproc_get_exitstatus(state->subproc);
7a8c6d
-	if (WIFEXITED(status) &&
7a8c6d
-	    (WEXITSTATUS(status) == CM_SUBMIT_STATUS_NEED_REKEY)) {
7a8c6d
-		return 0;
7a8c6d
-	}
7a8c6d
 	return -1;
7a8c6d
 }
7a8c6d
 
7a8c6d
diff --git a/src/tdbush.c b/src/tdbush.c
7a8c6d
index 7fb3d16..04fe57e 100644
7a8c6d
--- a/src/tdbush.c
7a8c6d
+++ b/src/tdbush.c
7a8c6d
@@ -7164,14 +7164,6 @@ cm_tdbush_iface_request(void)
7a8c6d
 										     cm_tdbush_method_arg_out,
7a8c6d
 										     NULL))),
7a8c6d
 								     NULL),
7a8c6d
-				     make_interface_item(cm_tdbush_interface_method,
7a8c6d
-							 make_method("rekey",
7a8c6d
-								     request_rekey,
7a8c6d
-								     make_method_arg("working",
7a8c6d
-										     DBUS_TYPE_BOOLEAN_AS_STRING,
7a8c6d
-										     cm_tdbush_method_arg_out,
7a8c6d
-										     NULL),
7a8c6d
-								     NULL),
7a8c6d
 				     make_interface_item(cm_tdbush_interface_method,
7a8c6d
 							 make_method("resubmit",
7a8c6d
 								     request_resubmit,
7a8c6d
@@ -7227,7 +7219,7 @@ cm_tdbush_iface_request(void)
7a8c6d
 				     make_interface_item(cm_tdbush_interface_signal,
7a8c6d
 							 make_signal(CM_DBUS_SIGNAL_REQUEST_CERT_SAVED,
7a8c6d
 								     NULL),
7a8c6d
-							 NULL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
7a8c6d
+							 NULL))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
7a8c6d
 	}
7a8c6d
 	return ret;
7a8c6d
 }
7a8c6d
diff --git a/tests/010-iterate/expected.out b/tests/010-iterate/expected.out
7a8c6d
index bd57a01..85d07b3 100644
7a8c6d
--- a/tests/010-iterate/expected.out
7a8c6d
+++ b/tests/010-iterate/expected.out
7a8c6d
@@ -398,19 +398,15 @@ HAVE_CSR
7a8c6d
 -START-
7a8c6d
 NEED_TO_SUBMIT
7a8c6d
 SUBMITTING
7a8c6d
-NEED_KEY_PAIR
7a8c6d
+NEED_GUIDANCE
7a8c6d
 -STOP-
7a8c6d
-NEED_KEY_PAIR
7a8c6d
+NEED_GUIDANCE
7a8c6d
 -START-
7a8c6d
-GENERATING_KEY_PAIR
7a8c6d
-HAVE_KEY_PAIR
7a8c6d
-NEED_KEYINFO
7a8c6d
+NEED_GUIDANCE
7a8c6d
 -STOP-
7a8c6d
-NEED_KEYINFO
7a8c6d
+NEED_GUIDANCE
7a8c6d
 -START-
7a8c6d
-READING_KEYINFO
7a8c6d
-HAVE_KEYINFO
7a8c6d
-NEED_CSR
7a8c6d
+NEED_GUIDANCE
7a8c6d
 -STOP-
7a8c6d
 
7a8c6d
 [Enroll until we notice we have no specified CA.]
7a8c6d
diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out
7a8c6d
index 8a81a7f..4c33e9a 100644
7a8c6d
--- a/tests/028-dbus/expected.out
7a8c6d
+++ b/tests/028-dbus/expected.out
7a8c6d
@@ -404,9 +404,6 @@ OK
7a8c6d
    <arg name="status" type="b" direction="out"/>
7a8c6d
    <arg name="path" type="o" direction="out"/>
7a8c6d
   </method>
7a8c6d
-  <method name="rekey">
7a8c6d
-   <arg name="working" type="b" direction="out"/>
7a8c6d
-  </method>
7a8c6d
   <method name="resubmit">
7a8c6d
    <arg name="working" type="b" direction="out"/>
7a8c6d
   </method>
7a8c6d
@@ -484,9 +481,6 @@ recently
7a8c6d
 1 on /org/fedorahosted/certmonger/requests/Request2
7a8c6d
 After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.String(u'1.2.3.4.5.6.7.8.9.10')], signature=dbus.Signature('s'), variant_level=1)
7a8c6d
 
7a8c6d
-[ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.rekey ]
7a8c6d
-1
7a8c6d
-
7a8c6d
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.resubmit ]
7a8c6d
 1
7a8c6d
 
7a8c6d
diff --git a/tests/036-getcert/expected.out b/tests/036-getcert/expected.out
7a8c6d
index c1a13c8..b6d1eaf 100644
7a8c6d
--- a/tests/036-getcert/expected.out
7a8c6d
+++ b/tests/036-getcert/expected.out
7a8c6d
@@ -11,20 +11,21 @@ certs:1
7a8c6d
 keys:1
7a8c6d
 -----BEGIN PRIVATE KEY-----
7a8c6d
 [Files, rekey]
7a8c6d
-Resubmitting "first" to "local".
7a8c6d
 certs:1
7a8c6d
 -----BEGIN CERTIFICATE-----
7a8c6d
 keys:1
7a8c6d
 -----BEGIN PRIVATE KEY-----
7a8c6d
+ERROR: keys were not changed on rekey
7a8c6d
+ERROR: cert was not changed on rekey
7a8c6d
 [Files, rekey with preserve=1]
7a8c6d
-Resubmitting "first" to "local".
7a8c6d
 certs:1
7a8c6d
 -----BEGIN CERTIFICATE-----
7a8c6d
-keys:2
7a8c6d
------BEGIN PRIVATE KEY-----
7a8c6d
+keys:1
7a8c6d
 -----BEGIN PRIVATE KEY-----
7a8c6d
+ERROR: keys were not changed on rekey
7a8c6d
+ERROR: cert was not changed on rekey
7a8c6d
+ERROR: old keys were not saved on rekey
7a8c6d
 [Files, rekey with jerk CA]
7a8c6d
-Resubmitting "first" to "jerkca".
7a8c6d
 certs:1
7a8c6d
 -----BEGIN CERTIFICATE-----
7a8c6d
 keys:1
7a8c6d
@@ -44,30 +45,31 @@ pk12util: PKCS12 EXPORT SUCCESSFUL
7a8c6d
 cert:1
7a8c6d
 key:1
7a8c6d
 [Database, rekey]
7a8c6d
-Resubmitting "first" to "local".
7a8c6d
 certs:1
7a8c6d
 keys:1
7a8c6d
 pk12util: PKCS12 EXPORT SUCCESSFUL
7a8c6d
 cert:1
7a8c6d
 key:1
7a8c6d
+ERROR: keys were not changed on rekey
7a8c6d
+ERROR: cert was not changed on rekey
7a8c6d
 [Database, rekey with preserve=1]
7a8c6d
-Resubmitting "first" to "local".
7a8c6d
 certs:1
7a8c6d
-keys:2
7a8c6d
+keys:1
7a8c6d
 pk12util: PKCS12 EXPORT SUCCESSFUL
7a8c6d
 cert:1
7a8c6d
 key:1
7a8c6d
+ERROR: keys were not changed on rekey
7a8c6d
+ERROR: cert was not changed on rekey
7a8c6d
+ERROR: old keys were not saved on rekey
7a8c6d
 [Database, rekey with jerk CA]
7a8c6d
-Resubmitting "first" to "jerkca".
7a8c6d
 certs:1
7a8c6d
-keys:3
7a8c6d
+keys:1
7a8c6d
 pk12util: PKCS12 EXPORT SUCCESSFUL
7a8c6d
 cert:1
7a8c6d
 key:1
7a8c6d
 [Database, rekey with jerk CA, nonpreserving]
7a8c6d
-Resubmitting "first" to "jerkca".
7a8c6d
 certs:1
7a8c6d
-keys:3
7a8c6d
+keys:1
7a8c6d
 pk12util: PKCS12 EXPORT SUCCESSFUL
7a8c6d
 cert:1
7a8c6d
 key:1
7a8c6d
diff --git a/tests/037-rekey2/expected.out b/tests/037-rekey2/expected.out
7a8c6d
index bd8cca7..62a1c74 100644
7a8c6d
--- a/tests/037-rekey2/expected.out
7a8c6d
+++ b/tests/037-rekey2/expected.out
7a8c6d
@@ -112,7 +112,7 @@ MONITORING
7a8c6d
 -STOP-
7a8c6d
 MONITORING
7a8c6d
 -START-
7a8c6d
-NEED_KEY_PAIR
7a8c6d
+NEED_CSR
7a8c6d
 -STOP-
7a8c6d
 [Uses = 2.]
7a8c6d
 NEED_KEY_PAIR
7a8c6d
@@ -228,6 +228,6 @@ MONITORING
7a8c6d
 -STOP-
7a8c6d
 MONITORING
7a8c6d
 -START-
7a8c6d
-NEED_KEY_PAIR
7a8c6d
+NEED_CSR
7a8c6d
 -STOP-
7a8c6d
 Test complete.
7a8c6d
-- 
7a8c6d
2.14.4
7a8c6d