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

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