Blame SOURCES/0085-ureport-provide-default-URLs.patch

0c9110
From b4379865f019888e3e0c6480e7ba02711168b17a Mon Sep 17 00:00:00 2001
0c9110
From: Jakub Filak <jfilak@redhat.com>
0c9110
Date: Tue, 23 Sep 2014 16:12:33 +0200
0c9110
Subject: [LIBREPORT PATCH 85/93] ureport: provide default URLs
0c9110
0c9110
We have two general use cases:
0c9110
1. Completely anonymous uReporting
0c9110
2. Authenticated uReporting
0c9110
0c9110
For good security reasons, we have to use a standalone server for each of
0c9110
these use cases and this requirement complicates the configuration.
0c9110
Users would have to change two options to switch between these two
0c9110
configurations.
0c9110
0c9110
The configuration can be simplified by providing default URL for both of
0c9110
them and single out the URL according to state of the "SSLClientAuth"
0c9110
configuration option.
0c9110
0c9110
1. Completely anonymous uReporting
0c9110
  - empty "SSLClientAuth"
0c9110
0c9110
2. Authenticated uReporting
0c9110
  - "rhsm" or "rhsm-entitlement" in "SSLClientAuth"
0c9110
0c9110
Related to rhbz#1140224
0c9110
0c9110
Signed-off-by: Jakub Filak <jfilak@redhat.com>
0c9110
---
0c9110
 src/lib/ureport.c              | 9 +++++++++
0c9110
 src/plugins/reporter-ureport.c | 4 +++-
0c9110
 src/plugins/ureport.conf       | 2 +-
0c9110
 3 files changed, 13 insertions(+), 2 deletions(-)
0c9110
0c9110
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
0c9110
index 26f3562..1a1520a 100644
0c9110
--- a/src/lib/ureport.c
0c9110
+++ b/src/lib/ureport.c
0c9110
@@ -30,6 +30,8 @@
0c9110
 
0c9110
 #define BTHASH_URL_SFX "reports/bthash/"
0c9110
 
0c9110
+#define RHSM_WEB_SERVICE_URL "https://api.access.redhat.com/rs/telemetry/abrt"
0c9110
+
0c9110
 #define RHSM_CERT_PATH "/etc/pki/consumer/cert.pem"
0c9110
 #define RHSM_KEY_PATH "/etc/pki/consumer/key.pem"
0c9110
 
0c9110
@@ -39,6 +41,7 @@
0c9110
 #define RHSMENT_SIG_DATA_BEGIN_TAG "-----BEGIN RSA SIGNATURE-----"
0c9110
 #define RHSMENT_SIG_DATA_END_TAG "-----END RSA SIGNATURE-----"
0c9110
 
0c9110
+
0c9110
 static char *
0c9110
 puppet_config_print(const char *key)
0c9110
 {
0c9110
@@ -88,11 +91,17 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
0c9110
     }
0c9110
     else if (strcmp(client_auth, "rhsm") == 0)
0c9110
     {
0c9110
+        if (config->ur_url == NULL)
0c9110
+            ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
0c9110
+
0c9110
         config->ur_client_cert = xstrdup(RHSM_CERT_PATH);
0c9110
         config->ur_client_key = xstrdup(RHSM_KEY_PATH);
0c9110
     }
0c9110
     else if (strcmp(client_auth, "rhsm-entitlement") == 0)
0c9110
     {
0c9110
+        if (config->ur_url == NULL)
0c9110
+            ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
0c9110
+
0c9110
         GList *certs = get_file_list(RHSMENT_PEM_DIR_PATH, "pem");
0c9110
         if (g_list_length(certs) != 2)
0c9110
         {
0c9110
diff --git a/src/plugins/reporter-ureport.c b/src/plugins/reporter-ureport.c
0c9110
index 06b5341..f15d56d 100644
0c9110
--- a/src/plugins/reporter-ureport.c
0c9110
+++ b/src/plugins/reporter-ureport.c
0c9110
@@ -22,6 +22,8 @@
0c9110
 #include "ureport.h"
0c9110
 #include "libreport_curl.h"
0c9110
 
0c9110
+#define DEFAULT_WEB_SERVICE_URL "http://bug-report.itos.redhat.com"
0c9110
+
0c9110
 int main(int argc, char **argv)
0c9110
 {
0c9110
     setlocale(LC_ALL, "");
0c9110
@@ -112,7 +114,7 @@ int main(int argc, char **argv)
0c9110
     }
0c9110
 
0c9110
     if (!config.ur_url)
0c9110
-        error_msg_and_die("You need to specify server URL");
0c9110
+        ureport_server_config_set_url(&config, xstrdup(DEFAULT_WEB_SERVICE_URL));
0c9110
 
0c9110
     if (ureport_hash && ureport_hash_from_rt)
0c9110
         error_msg_and_die("You need to pass either -a bthash or -A");
0c9110
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
0c9110
index fc0dc21..a20695d 100644
0c9110
--- a/src/plugins/ureport.conf
0c9110
+++ b/src/plugins/ureport.conf
0c9110
@@ -1,5 +1,5 @@
0c9110
 # Base URL to uReport server
0c9110
-URL = http://bug-report.itos.redhat.com
0c9110
+# URL = http://bug-report.itos.redhat.com
0c9110
 
0c9110
 # no means that ssl certificates will not be checked
0c9110
 # SSLVerify = no
0c9110
-- 
0c9110
1.8.3.1
0c9110