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

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