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

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