Blame SOURCES/0086-ureport-include-AuthDataItems-if-SSLClientAuth-is-co.patch

28bab8
From ed3b5cebd6b78da4f52d0c417f03550109262f5c Mon Sep 17 00:00:00 2001
28bab8
From: Jakub Filak <jfilak@redhat.com>
28bab8
Date: Tue, 23 Sep 2014 20:55:48 +0200
28bab8
Subject: [LIBREPORT PATCH 86/93] ureport: include AuthDataItems if
28bab8
 SSLClientAuth is configured
28bab8
28bab8
Forcing users to configure more than one configuration option to enable
28bab8
Authenticated uReporting isn't good idea. So for sake of simplicity
28bab8
reporter-ureport will add the AuthDataItems in to an uReport by default
28bab8
if the SSLClientAuth is set to some value. Putting 'no' to
28bab8
the IncludeAuthData configuration option, stops reporter-ureport from
28bab8
including the AuthDataItems in uReports.
28bab8
28bab8
Related to rhbz#1139557
28bab8
28bab8
Signed-off-by: Jakub Filak <jfilak@redhat.com>
28bab8
---
28bab8
 doc/reporter-ureport.txt |  9 +++++++--
28bab8
 src/lib/ureport.c        | 11 ++++++-----
28bab8
 src/plugins/ureport.conf |  8 ++++++--
28bab8
 3 files changed, 19 insertions(+), 9 deletions(-)
28bab8
28bab8
diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
28bab8
index fbdb6e9..551bbda 100644
28bab8
--- a/doc/reporter-ureport.txt
28bab8
+++ b/doc/reporter-ureport.txt
28bab8
@@ -29,8 +29,10 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
28bab8
 
28bab8
 'SSLClientAuth'::
28bab8
    If this option is set, client-side SSL certificate is used to authenticate
28bab8
-   to the server so that it knows which machine it came from. Possible values
28bab8
-   are:
28bab8
+   to the server so that it knows which machine it came from. Assigning any value to
28bab8
+   this option changes the default value of IncludeAuthData to yes.
28bab8
+
28bab8
+   Possible values are:
28bab8
 
28bab8
    'rhsm';;
28bab8
       Uses the system certificate that is used for Red Hat subscription management.
28bab8
@@ -49,6 +51,9 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
28bab8
    consisting from key value pairs made from CSV list stored in 'AuthDataItems'
28bab8
    option. Keys are file names and values are bites of these files.
28bab8
 
28bab8
+   The default value is no, unless you set SSLClientAuth to some value. In that
28bab8
+   case, the default value is yes.
28bab8
+
28bab8
 'AuthDataItems'::
28bab8
    CSV list of files included in the 'auth' uReport object.
28bab8
 
28bab8
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
28bab8
index 1a1520a..f906f3e 100644
28bab8
--- a/src/lib/ureport.c
28bab8
+++ b/src/lib/ureport.c
28bab8
@@ -231,7 +231,12 @@ ureport_server_config_load(struct ureport_server_config *config,
28bab8
     UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", config->ur_url, xstrdup);
28bab8
     UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLVerify", config->ur_ssl_verify, string_to_bool);
28bab8
 
28bab8
-    bool include_auth = false;
28bab8
+    const char *client_auth = NULL;
28bab8
+    UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLClientAuth", client_auth, (const char *));
28bab8
+    ureport_server_config_set_client_auth(config, client_auth);
28bab8
+
28bab8
+    /* If SSLClientAuth is configured, include the auth items by default. */
28bab8
+    bool include_auth = !!config->ur_client_cert;
28bab8
     UREPORT_OPTION_VALUE_FROM_CONF(settings, "IncludeAuthData", include_auth, string_to_bool);
28bab8
 
28bab8
     if (include_auth)
28bab8
@@ -243,10 +248,6 @@ ureport_server_config_load(struct ureport_server_config *config,
28bab8
         if (config->ur_prefs.urp_auth_items == NULL)
28bab8
             log_warning("IncludeAuthData set to 'yes' but AuthDataItems is empty.");
28bab8
     }
28bab8
-
28bab8
-    const char *client_auth = NULL;
28bab8
-    UREPORT_OPTION_VALUE_FROM_CONF(settings, "SSLClientAuth", client_auth, (const char *));
28bab8
-    ureport_server_config_set_client_auth(config, client_auth);
28bab8
 }
28bab8
 
28bab8
 void
28bab8
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
28bab8
index a20695d..e7bd66b 100644
28bab8
--- a/src/plugins/ureport.conf
28bab8
+++ b/src/plugins/ureport.conf
28bab8
@@ -8,14 +8,18 @@
28bab8
 # ContactEmail = foo@example.com
28bab8
 
28bab8
 # yes means that uReport will contain 'auth' object consisting
28bab8
-# from key value pairs made from AuthDataItems
28bab8
+# from key value pairs made from AuthDataItems.
28bab8
+# The default value is 'no', unless you set 'SSLClientAuth' to some value.
28bab8
+# In that case, the default value is 'yes'.
28bab8
 # IncludeAuthData = yes
28bab8
 
28bab8
 # If IncludeAuthData is set to yes, these fields will be included
28bab8
 # in 'auth' object
28bab8
 AuthDataItems = hostname, machineid
28bab8
 
28bab8
-# Client-side authentication
28bab8
+# Client-side authentication.
28bab8
+# Assingning any value to 'SSLClientAuth' changes the default value of
28bab8
+# 'IncludeAuthData' to 'yes'.
28bab8
 # None (default):
28bab8
 # SSLClientAuth =
28bab8
 # Using RH subscription management certificate:
28bab8
-- 
28bab8
1.8.3.1
28bab8