|
|
e9710e |
From 646101d558765b59bae94aa27bfbefed3a085ab5 Mon Sep 17 00:00:00 2001
|
|
|
e9710e |
From: Ernestas Kulik <ekulik@redhat.com>
|
|
|
e9710e |
Date: Tue, 2 Jun 2020 10:57:36 +0200
|
|
|
e9710e |
Subject: [PATCH] ureport: Drop Strata integration
|
|
|
e9710e |
|
|
|
e9710e |
Strata is being sunset with no replacement for our used API endpoints in
|
|
|
e9710e |
sight. This commit drops the integration code, because no one pretty
|
|
|
e9710e |
much wants it, either.
|
|
|
e9710e |
---
|
|
|
e9710e |
configure.ac | 11 --
|
|
|
e9710e |
doc/reporter-rhtsupport.txt | 17 --
|
|
|
e9710e |
doc/reporter-ureport.txt | 8 -
|
|
|
e9710e |
src/include/ureport.h | 4 +-
|
|
|
e9710e |
src/lib/ureport.c | 138 +--------------
|
|
|
e9710e |
src/plugins/Makefile.am | 6 -
|
|
|
e9710e |
src/plugins/cert-api.access.redhat.com.pem | 74 --------
|
|
|
e9710e |
src/plugins/report_RHTSupport.xml.in | 5 -
|
|
|
e9710e |
src/plugins/reporter-rhtsupport.c | 186 +--------------------
|
|
|
e9710e |
src/plugins/ureport.conf | 4 -
|
|
|
e9710e |
tests/ureport.at | 174 -------------------
|
|
|
e9710e |
tests/ureport/rhsm/__init__.py | 0
|
|
|
e9710e |
tests/ureport/rhsm/config.py | 8 -
|
|
|
e9710e |
13 files changed, 7 insertions(+), 628 deletions(-)
|
|
|
e9710e |
delete mode 100644 src/plugins/cert-api.access.redhat.com.pem
|
|
|
e9710e |
delete mode 100644 tests/ureport/rhsm/__init__.py
|
|
|
e9710e |
delete mode 100644 tests/ureport/rhsm/config.py
|
|
|
e9710e |
|
|
|
e9710e |
diff --git a/configure.ac b/configure.ac
|
|
|
e9710e |
index ce45389..ef35f84 100644
|
|
|
e9710e |
--- a/configure.ac
|
|
|
e9710e |
+++ b/configure.ac
|
|
|
e9710e |
@@ -172,17 +172,6 @@ do
|
|
|
e9710e |
done
|
|
|
e9710e |
fi dnl end NO_MANTISBT
|
|
|
e9710e |
|
|
|
e9710e |
-dnl enable import of certificate for rhtsupport plugin
|
|
|
e9710e |
-AC_ARG_ENABLE([import-rhtsupport-cert],
|
|
|
e9710e |
-AS_HELP_STRING([--enable-import-rhtsupport-cert],
|
|
|
e9710e |
- [import certificate needed for rhtsupport plugin (default is NO)]),
|
|
|
e9710e |
-[], [enable_import_rhtsupport_cert="no"])
|
|
|
e9710e |
-
|
|
|
e9710e |
-AS_IF([test "x$enable_import_rhtsupport_cert" != "xno"],
|
|
|
e9710e |
-AM_CONDITIONAL(ENABLE_IMPORT_RHTSUPPORT_CERT, true),
|
|
|
e9710e |
-AM_CONDITIONAL(ENABLE_IMPORT_RHTSUPPORT_CERT, false))
|
|
|
e9710e |
-
|
|
|
e9710e |
-
|
|
|
e9710e |
AC_ARG_WITH(python2,
|
|
|
e9710e |
AS_HELP_STRING([--with-python2],[use python2 (default is YES)]),
|
|
|
e9710e |
LIBREPORT_PARSE_WITH([python2]))
|
|
|
e9710e |
diff --git a/doc/reporter-rhtsupport.txt b/doc/reporter-rhtsupport.txt
|
|
|
e9710e |
index e52a152..132c0ea 100644
|
|
|
e9710e |
--- a/doc/reporter-rhtsupport.txt
|
|
|
e9710e |
+++ b/doc/reporter-rhtsupport.txt
|
|
|
e9710e |
@@ -18,9 +18,6 @@ DESCRIPTION
|
|
|
e9710e |
The tool reads problem directory DIR. Then it logs in to RHTSupport
|
|
|
e9710e |
and creates a new case.
|
|
|
e9710e |
|
|
|
e9710e |
-The tool can be configured to submit an uReport to RHTSupport together with
|
|
|
e9710e |
-creating a new case.
|
|
|
e9710e |
-
|
|
|
e9710e |
The URL to new case is printed to stdout and recorded in 'reported_to'
|
|
|
e9710e |
element in DIR.
|
|
|
e9710e |
|
|
|
e9710e |
@@ -36,10 +33,6 @@ to enter case ID to which you want to upload the FILEs.
|
|
|
e9710e |
Option -tCASE uploads FILEs to the case CASE on RHTSupport site.
|
|
|
e9710e |
-d DIR is ignored.
|
|
|
e9710e |
|
|
|
e9710e |
-Option -u uploads uReport along with creating a new case. uReport configuration
|
|
|
e9710e |
-is loaded from UR_CONFFILE which defaults to
|
|
|
e9710e |
-/etc/libreport/plugins/ureport.conf.
|
|
|
e9710e |
-
|
|
|
e9710e |
Configuration file
|
|
|
e9710e |
~~~~~~~~~~~~~~~~~~
|
|
|
e9710e |
Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
|
|
|
e9710e |
@@ -56,10 +49,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
|
|
|
e9710e |
'SSLVerify'::
|
|
|
e9710e |
Use yes/true/on/1 to verify server's SSL certificate. (default: yes)
|
|
|
e9710e |
|
|
|
e9710e |
-'SubmitUReport'::
|
|
|
e9710e |
- Use yes/true/on/1 to enable submitting uReport together wit creating a new
|
|
|
e9710e |
- case. (default: no)
|
|
|
e9710e |
-
|
|
|
e9710e |
Parameters can be overridden via $RHTSupport_PARAM environment variables.
|
|
|
e9710e |
|
|
|
e9710e |
Integration with ABRT events
|
|
|
e9710e |
@@ -84,12 +73,6 @@ OPTIONS
|
|
|
e9710e |
-t[ID]::
|
|
|
e9710e |
Upload FILEs to the already created case on RHTSupport site.
|
|
|
e9710e |
|
|
|
e9710e |
--u::
|
|
|
e9710e |
- Submit uReport together with creating a new case.
|
|
|
e9710e |
-
|
|
|
e9710e |
--C UR_CONFFILE::
|
|
|
e9710e |
- Configuration file for submitting uReports.
|
|
|
e9710e |
-
|
|
|
e9710e |
-F CONF_FORMAT_FILE::
|
|
|
e9710e |
Formatting file for a new case.
|
|
|
e9710e |
|
|
|
e9710e |
diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt
|
|
|
e9710e |
index 7deb911..fc06541 100644
|
|
|
e9710e |
--- a/doc/reporter-ureport.txt
|
|
|
e9710e |
+++ b/doc/reporter-ureport.txt
|
|
|
e9710e |
@@ -34,10 +34,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
|
|
|
e9710e |
|
|
|
e9710e |
Possible values are:
|
|
|
e9710e |
|
|
|
e9710e |
- 'rhsm';;
|
|
|
e9710e |
- Uses the system V3 entitlement certificate that is used for Red Hat
|
|
|
e9710e |
- subscription management.
|
|
|
e9710e |
-
|
|
|
e9710e |
'puppet';;
|
|
|
e9710e |
Uses the certificate that is used by the Puppet configuration management tool.
|
|
|
e9710e |
|
|
|
e9710e |
@@ -51,10 +47,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are:
|
|
|
e9710e |
|
|
|
e9710e |
Possible values are::
|
|
|
e9710e |
|
|
|
e9710e |
- 'rhts-credentials';;
|
|
|
e9710e |
- Uses Login= and Password= values from /etc/libreport/plugins/rhtsupport.conf and
|
|
|
e9710e |
- user's local ~/.config/libreport/rhtsupport.conf.
|
|
|
e9710e |
-
|
|
|
e9710e |
'<user_name>:<password>';;
|
|
|
e9710e |
Manually supply credentials.
|
|
|
e9710e |
|
|
|
e9710e |
diff --git a/src/include/ureport.h b/src/include/ureport.h
|
|
|
e9710e |
index 63d9bf2..2e6de49 100644
|
|
|
e9710e |
--- a/src/include/ureport.h
|
|
|
e9710e |
+++ b/src/include/ureport.h
|
|
|
e9710e |
@@ -115,8 +115,7 @@ ureport_server_config_set_url(struct ureport_server_config *config,
|
|
|
e9710e |
* Configure client certificate paths
|
|
|
e9710e |
*
|
|
|
e9710e |
* @param config Where the paths are stored
|
|
|
e9710e |
- * @param client_path Path in form of cert_full_path:key_full_path or one of
|
|
|
e9710e |
- * the following string: 'rhsm', 'puppet'.
|
|
|
e9710e |
+ * @param client_path Path in form of cert_full_path:key_full_path or 'puppet'.
|
|
|
e9710e |
*/
|
|
|
e9710e |
#define ureport_server_config_set_client_auth libreport_ureport_server_config_set_client_auth
|
|
|
e9710e |
void
|
|
|
e9710e |
@@ -139,7 +138,6 @@ ureport_server_config_set_basic_auth(struct ureport_server_config *config,
|
|
|
e9710e |
* Configure user name and password for HTTP Basic authentication according to
|
|
|
e9710e |
* user preferences.
|
|
|
e9710e |
*
|
|
|
e9710e |
- * "rhts-credentials" - Uses Login= and Password= from rhtsupport.conf
|
|
|
e9710e |
* "<user_name>:<password>" - Manually supply user name and password.
|
|
|
e9710e |
* "<user_name>" - Manually supply user name and be asked for password.
|
|
|
e9710e |
*
|
|
|
e9710e |
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
|
|
|
e9710e |
index ced4810..5d0a820 100644
|
|
|
e9710e |
--- a/src/lib/ureport.c
|
|
|
e9710e |
+++ b/src/lib/ureport.c
|
|
|
e9710e |
@@ -30,19 +30,6 @@
|
|
|
e9710e |
|
|
|
e9710e |
#define BTHASH_URL_SFX "reports/bthash/"
|
|
|
e9710e |
|
|
|
e9710e |
-#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt"
|
|
|
e9710e |
-
|
|
|
e9710e |
-#define RHSMCON_PEM_DIR_PATH "/etc/pki/consumer"
|
|
|
e9710e |
-#define RHSMCON_CERT_NAME "cert.pem"
|
|
|
e9710e |
-#define RHSMCON_KEY_NAME "key.pem"
|
|
|
e9710e |
-
|
|
|
e9710e |
-/* Using the same template as for RHSM certificate, macro for cert dir path and
|
|
|
e9710e |
- * macro for cert name. Cert path can be easily modified for example by reading
|
|
|
e9710e |
- * an environment variable LIBREPORT_DEBUG_AUTHORITY_CERT_DIR_PATH
|
|
|
e9710e |
- */
|
|
|
e9710e |
-#define CERT_AUTHORITY_CERT_PATH "/etc/libreport"
|
|
|
e9710e |
-#define CERT_AUTHORITY_CERT_NAME "cert-api.access.redhat.com.pem"
|
|
|
e9710e |
-
|
|
|
e9710e |
static char *
|
|
|
e9710e |
puppet_config_print(const char *key)
|
|
|
e9710e |
{
|
|
|
e9710e |
@@ -73,55 +60,6 @@ ureport_server_config_set_url(struct ureport_server_config *config,
|
|
|
e9710e |
config->ur_url = server_url;
|
|
|
e9710e |
}
|
|
|
e9710e |
|
|
|
e9710e |
-static char *
|
|
|
e9710e |
-rhsm_config_get_consumer_cert_dir(void)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- char *result = getenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
|
|
|
e9710e |
- if (result != NULL)
|
|
|
e9710e |
- return xstrdup(result);
|
|
|
e9710e |
-
|
|
|
e9710e |
- result = run_in_shell_and_save_output(0,
|
|
|
e9710e |
- "python3 -c \"from rhsm.config import initConfig; print(initConfig().get('rhsm', 'consumerCertDir'))\"",
|
|
|
e9710e |
- NULL, NULL);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* run_in_shell_and_save_output always returns non-NULL */
|
|
|
e9710e |
- if (result[0] != '/')
|
|
|
e9710e |
- goto error;
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *newline = strchrnul(result, '\n');
|
|
|
e9710e |
- if (!newline)
|
|
|
e9710e |
- goto error;
|
|
|
e9710e |
-
|
|
|
e9710e |
- *newline = '\0';
|
|
|
e9710e |
- return result;
|
|
|
e9710e |
-error:
|
|
|
e9710e |
- free(result);
|
|
|
e9710e |
- error_msg("Failed to get 'rhsm':'consumerCertDir' from rhsm.config python module. Using "RHSMCON_PEM_DIR_PATH);
|
|
|
e9710e |
- return xstrdup(RHSMCON_PEM_DIR_PATH);
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
-static bool
|
|
|
e9710e |
-certificate_exist(char *cert_name)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- if (access(cert_name, F_OK) != 0)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_notice("RHSM consumer certificate '%s' does not exist.", cert_name);
|
|
|
e9710e |
- return false;
|
|
|
e9710e |
- }
|
|
|
e9710e |
- return true;
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
-static bool
|
|
|
e9710e |
-cert_authority_cert_exist(char *cert_name)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- if (access(cert_name, F_OK) != 0)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_notice("Certs validating the server '%s' does not exist.", cert_name);
|
|
|
e9710e |
- return false;
|
|
|
e9710e |
- }
|
|
|
e9710e |
- return true;
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
void
|
|
|
e9710e |
ureport_server_config_set_client_auth(struct ureport_server_config *config,
|
|
|
e9710e |
const char *client_auth)
|
|
|
e9710e |
@@ -139,52 +77,6 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config,
|
|
|
e9710e |
|
|
|
e9710e |
log_notice("Not using client authentication");
|
|
|
e9710e |
}
|
|
|
e9710e |
- else if (strcmp(client_auth, "rhsm") == 0)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- if (config->ur_url == NULL)
|
|
|
e9710e |
- ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* always returns non-NULL */
|
|
|
e9710e |
- char *rhsm_dir = rhsm_config_get_consumer_cert_dir();
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *cert_full_name = concat_path_file(rhsm_dir, RHSMCON_CERT_NAME);
|
|
|
e9710e |
- char *key_full_name = concat_path_file(rhsm_dir, RHSMCON_KEY_NAME);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* get authority certificate dir path from environment variable, if it
|
|
|
e9710e |
- * is not set, use CERT_AUTHORITY_CERT_PATH
|
|
|
e9710e |
- */
|
|
|
e9710e |
- const char *authority_cert_dir_path = getenv("LIBREPORT_DEBUG_AUTHORITY_CERT_DIR_PATH");
|
|
|
e9710e |
- if (authority_cert_dir_path == NULL)
|
|
|
e9710e |
- authority_cert_dir_path = CERT_AUTHORITY_CERT_PATH;
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *cert_authority_cert_full_name = concat_path_file(authority_cert_dir_path,
|
|
|
e9710e |
- CERT_AUTHORITY_CERT_NAME);
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (certificate_exist(cert_full_name) && certificate_exist(key_full_name))
|
|
|
e9710e |
- {
|
|
|
e9710e |
- config->ur_client_cert = cert_full_name;
|
|
|
e9710e |
- config->ur_client_key = key_full_name;
|
|
|
e9710e |
- log_debug("Using cert files: '%s' : '%s'", config->ur_client_cert, config->ur_client_key);
|
|
|
e9710e |
- }
|
|
|
e9710e |
- else
|
|
|
e9710e |
- {
|
|
|
e9710e |
- free(cert_full_name);
|
|
|
e9710e |
- free(key_full_name);
|
|
|
e9710e |
- log_notice("Using the default configuration for uReports.");
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (cert_authority_cert_exist(cert_authority_cert_full_name))
|
|
|
e9710e |
- {
|
|
|
e9710e |
- config->ur_cert_authority_cert = cert_authority_cert_full_name;
|
|
|
e9710e |
- log_debug("Using validating server cert: '%s'", config->ur_cert_authority_cert);
|
|
|
e9710e |
- }
|
|
|
e9710e |
- else
|
|
|
e9710e |
- {
|
|
|
e9710e |
- free(cert_authority_cert_full_name);
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- free(rhsm_dir);
|
|
|
e9710e |
- }
|
|
|
e9710e |
else if (strcmp(client_auth, "puppet") == 0)
|
|
|
e9710e |
{
|
|
|
e9710e |
config->ur_client_cert = puppet_config_print("hostcert");
|
|
|
e9710e |
@@ -241,32 +133,12 @@ ureport_server_config_load_basic_auth(struct ureport_server_config *config,
|
|
|
e9710e |
const char *username = NULL;
|
|
|
e9710e |
const char *password = NULL;
|
|
|
e9710e |
|
|
|
e9710e |
- if (strcmp(http_auth_pref, "rhts-credentials") == 0)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- settings = new_map_string();
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *local_conf = xasprintf("%s"USER_HOME_CONFIG_PATH"/rhtsupport.conf", getenv("HOME"));
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (!load_plugin_conf_file("rhtsupport.conf", settings, /*skip key w/o values:*/ false) &&
|
|
|
e9710e |
- !load_conf_file(local_conf, settings, /*skip key w/o values:*/ false))
|
|
|
e9710e |
- error_msg_and_die("Could not get RHTSupport credentials");
|
|
|
e9710e |
- free(local_conf);
|
|
|
e9710e |
-
|
|
|
e9710e |
- username = get_map_string_item_or_NULL(settings, "Login");
|
|
|
e9710e |
- password = get_map_string_item_or_NULL(settings, "Password");
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (config->ur_url == NULL)
|
|
|
e9710e |
- ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL));
|
|
|
e9710e |
- }
|
|
|
e9710e |
- else
|
|
|
e9710e |
- {
|
|
|
e9710e |
- username = tmp_username = xstrdup(http_auth_pref);
|
|
|
e9710e |
- password = strchr(tmp_username, ':');
|
|
|
e9710e |
+ username = tmp_username = xstrdup(http_auth_pref);
|
|
|
e9710e |
+ password = strchr(tmp_username, ':');
|
|
|
e9710e |
|
|
|
e9710e |
- if (password != NULL)
|
|
|
e9710e |
- /* It is "char *", see strchr() few lines above. */
|
|
|
e9710e |
- *((char *)(password++)) = '\0';
|
|
|
e9710e |
- }
|
|
|
e9710e |
+ if (password != NULL)
|
|
|
e9710e |
+ /* It is "char *", see strchr() few lines above. */
|
|
|
e9710e |
+ *((char *)(password++)) = '\0';
|
|
|
e9710e |
|
|
|
e9710e |
if (password == NULL)
|
|
|
e9710e |
{
|
|
|
e9710e |
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
|
|
|
e9710e |
index b228602..f73e7dc 100644
|
|
|
e9710e |
--- a/src/plugins/Makefile.am
|
|
|
e9710e |
+++ b/src/plugins/Makefile.am
|
|
|
e9710e |
@@ -28,12 +28,6 @@ pluginsconfdir = $(PLUGINS_CONF_DIR)
|
|
|
e9710e |
|
|
|
e9710e |
reportpluginsconfdir = $(REPORT_PLUGINS_CONF_DIR)
|
|
|
e9710e |
|
|
|
e9710e |
-if ENABLE_IMPORT_RHTSUPPORT_CERT
|
|
|
e9710e |
-libreportconfdir = $(CONF_DIR)
|
|
|
e9710e |
-dist_libreportconf_DATA = \
|
|
|
e9710e |
- cert-api.access.redhat.com.pem
|
|
|
e9710e |
-endif
|
|
|
e9710e |
-
|
|
|
e9710e |
reporters_plugin_conf =
|
|
|
e9710e |
reporters_plugin_format_conf =
|
|
|
e9710e |
if BUILD_BUGZILLA
|
|
|
e9710e |
diff --git a/src/plugins/cert-api.access.redhat.com.pem b/src/plugins/cert-api.access.redhat.com.pem
|
|
|
e9710e |
deleted file mode 100644
|
|
|
e9710e |
index 20ef8c0..0000000
|
|
|
e9710e |
--- a/src/plugins/cert-api.access.redhat.com.pem
|
|
|
e9710e |
+++ /dev/null
|
|
|
e9710e |
@@ -1,74 +0,0 @@
|
|
|
e9710e |
------BEGIN CERTIFICATE-----
|
|
|
e9710e |
-MIIHZDCCBUygAwIBAgIJAOb+QiglyeZeMA0GCSqGSIb3DQEBBQUAMIGwMQswCQYD
|
|
|
e9710e |
-VQQGEwJVUzEXMBUGA1UECAwOTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcMB1JhbGVp
|
|
|
e9710e |
-Z2gxFjAUBgNVBAoMDVJlZCBIYXQsIEluYy4xGDAWBgNVBAsMD1JlZCBIYXQgTmV0
|
|
|
e9710e |
-d29yazEeMBwGA1UEAwwVRW50aXRsZW1lbnQgTWFzdGVyIENBMSQwIgYJKoZIhvcN
|
|
|
e9710e |
-AQkBFhVjYS1zdXBwb3J0QHJlZGhhdC5jb20wHhcNMTAwMzE3MTkwMDQ0WhcNMzAw
|
|
|
e9710e |
-MzEyMTkwMDQ0WjCBsDELMAkGA1UEBhMCVVMxFzAVBgNVBAgMDk5vcnRoIENhcm9s
|
|
|
e9710e |
-aW5hMRAwDgYDVQQHDAdSYWxlaWdoMRYwFAYDVQQKDA1SZWQgSGF0LCBJbmMuMRgw
|
|
|
e9710e |
-FgYDVQQLDA9SZWQgSGF0IE5ldHdvcmsxHjAcBgNVBAMMFUVudGl0bGVtZW50IE1h
|
|
|
e9710e |
-c3RlciBDQTEkMCIGCSqGSIb3DQEJARYVY2Etc3VwcG9ydEByZWRoYXQuY29tMIIC
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BrMr5Buk7eaBBJ2PxECNiWLCRQJWmyff1O5zMT0daS2lBdEGUNhBZ0hnX13Q
|
|
|
e9710e |
-kabUp0bxRrNRq+WkomP7onZhfZS6SjKm0UmwoV6o3V1ED6y7muQNRmgDpA5PcbvO
|
|
|
e9710e |
-gl7OexNL4zcpyfMdAmTYf5yTRSvB42Yg5hVfuzPEnOIqupwES3mWkEHRlqbMUkHw
|
|
|
e9710e |
-qIQAxIwQqZd5PdPpElQ/6j/ZT9DwW/I6zgndX2rsS0oGYcwFTkSj0/rKKkC13hk7
|
|
|
e9710e |
-LchXMZu5ckdustM79U6OZIBairrJaL2OpR08un2nwIjgEGqhVFYc44UK1VpkE8mr
|
|
|
e9710e |
-qvqJS6OHVlTlKcEDnhVkPS3i5qjuS/PtSq0CwH8bzYKFJayLDY/z36Zv6PdttzmU
|
|
|
e9710e |
-Yb1NSDcJejHJ80pMINutyYQ=
|
|
|
e9710e |
------END CERTIFICATE-----
|
|
|
e9710e |
diff --git a/src/plugins/report_RHTSupport.xml.in b/src/plugins/report_RHTSupport.xml.in
|
|
|
e9710e |
index 357a94d..c64cb55 100644
|
|
|
e9710e |
--- a/src/plugins/report_RHTSupport.xml.in
|
|
|
e9710e |
+++ b/src/plugins/report_RHTSupport.xml.in
|
|
|
e9710e |
@@ -26,11 +26,6 @@
|
|
|
e9710e |
<allow-empty>no</allow-empty>
|
|
|
e9710e |
</option>
|
|
|
e9710e |
<advanced-options>
|
|
|
e9710e |
- <option type="bool" name="RHTSupport_SubmitUReport">
|
|
|
e9710e |
- <_label>Submit uReport</_label>
|
|
|
e9710e |
- <_note-html>Submit <a href="https://access.redhat.com/articles/642323">micro-report</a> when creating a new case. </_note-html>
|
|
|
e9710e |
- <default-value>yes</default-value>
|
|
|
e9710e |
- </option>
|
|
|
e9710e |
<option type="text" name="RHTSupport_URL">
|
|
|
e9710e |
<_label>RH Portal URL</_label>
|
|
|
e9710e |
<allow-empty>no</allow-empty>
|
|
|
e9710e |
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
|
|
|
e9710e |
index d11b4bd..411bffc 100644
|
|
|
e9710e |
--- a/src/plugins/reporter-rhtsupport.c
|
|
|
e9710e |
+++ b/src/plugins/reporter-rhtsupport.c
|
|
|
e9710e |
@@ -222,96 +222,6 @@ ret_clean:
|
|
|
e9710e |
return retval;
|
|
|
e9710e |
}
|
|
|
e9710e |
|
|
|
e9710e |
-static
|
|
|
e9710e |
-struct ureport_server_response *ureport_do_post_credentials(const char *json, struct ureport_server_config *config, const char *action)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- struct post_state *post_state = NULL;
|
|
|
e9710e |
- while (1)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- post_state = ureport_do_post(json, config, action);
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (post_state == NULL)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- error_msg(_("Failed on submitting the problem"));
|
|
|
e9710e |
- return NULL;
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (post_state->http_resp_code != 401)
|
|
|
e9710e |
- break;
|
|
|
e9710e |
-
|
|
|
e9710e |
- free_post_state(post_state);
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *login = NULL;
|
|
|
e9710e |
- char *password = NULL;
|
|
|
e9710e |
- ask_rh_credentials(&login, &password);
|
|
|
e9710e |
- ureport_server_config_set_basic_auth(config, login, password);
|
|
|
e9710e |
- free(password);
|
|
|
e9710e |
- free(login);
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- struct ureport_server_response *resp = ureport_server_response_from_reply(post_state, config);
|
|
|
e9710e |
- free(post_state);
|
|
|
e9710e |
- return resp;
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
-static
|
|
|
e9710e |
-char *submit_ureport(const char *dump_dir_name, struct ureport_server_config *conf)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
|
|
|
e9710e |
- if (dd == NULL)
|
|
|
e9710e |
- return NULL;
|
|
|
e9710e |
-
|
|
|
e9710e |
- report_result_t *rr_bthash = find_in_reported_to(dd, "uReport");
|
|
|
e9710e |
- dd_close(dd);
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (rr_bthash != NULL)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_notice("uReport has already been submitted.");
|
|
|
e9710e |
- char *ret = xstrdup(rr_bthash->bthash);
|
|
|
e9710e |
- free_report_result(rr_bthash);
|
|
|
e9710e |
- return ret;
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *json = ureport_from_dump_dir(dump_dir_name);
|
|
|
e9710e |
- if (json == NULL)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_notice(_("Failed to generate microreport from the problem data"));
|
|
|
e9710e |
- return NULL;
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_SUBMIT_ACTION);
|
|
|
e9710e |
- free(json);
|
|
|
e9710e |
- if (resp == NULL)
|
|
|
e9710e |
- return NULL;
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *bthash = NULL;
|
|
|
e9710e |
- if (!resp->urr_is_error)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- if (resp->urr_bthash != NULL)
|
|
|
e9710e |
- bthash = xstrdup(resp->urr_bthash);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_response_save_in_dump_dir(resp, dump_dir_name, conf);
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (resp->urr_message)
|
|
|
e9710e |
- log_warning("%s", resp->urr_message);
|
|
|
e9710e |
- }
|
|
|
e9710e |
- else if (g_verbose > 2)
|
|
|
e9710e |
- error_msg(_("Server responded with an error: '%s'"), resp->urr_value);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_response_free(resp);
|
|
|
e9710e |
- return bthash;
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
-static
|
|
|
e9710e |
-void attach_to_ureport(struct ureport_server_config *conf,
|
|
|
e9710e |
- const char *bthash, const char *attach_id, const char *data)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- char *json = ureport_json_attachment_new(bthash, attach_id, data);
|
|
|
e9710e |
- struct ureport_server_response *resp = ureport_do_post_credentials(json, conf, UREPORT_ATTACH_ACTION);
|
|
|
e9710e |
- ureport_server_response_free(resp);
|
|
|
e9710e |
- free(json);
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
static
|
|
|
e9710e |
bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
|
|
|
e9710e |
{
|
|
|
e9710e |
@@ -420,42 +330,6 @@ char *get_param_string(const char *name, map_string_t *settings, const char *dfl
|
|
|
e9710e |
return xstrdup(envvar ? envvar : (get_map_string_item_or_NULL(settings, name) ? : dflt));
|
|
|
e9710e |
}
|
|
|
e9710e |
|
|
|
e9710e |
-static
|
|
|
e9710e |
-void prepare_ureport_configuration(const char *urcfile,
|
|
|
e9710e |
- map_string_t *settings, struct ureport_server_config *urconf,
|
|
|
e9710e |
- const char *portal_url, const char *login, const char *password, bool ssl_verify)
|
|
|
e9710e |
-{
|
|
|
e9710e |
- load_conf_file(urcfile, settings, false);
|
|
|
e9710e |
- ureport_server_config_init(urconf);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* The following lines cause that we always use URL from ureport's
|
|
|
e9710e |
- * configuration becuase the GUI reporter always exports uReport_URL env
|
|
|
e9710e |
- * var.
|
|
|
e9710e |
- *
|
|
|
e9710e |
- * char *url = NULL;
|
|
|
e9710e |
- * UREPORT_OPTION_VALUE_FROM_CONF(settings, "URL", url, xstrdup);
|
|
|
e9710e |
- * if (url != NULL)
|
|
|
e9710e |
- * ureport_server_config_set_url(urconf, url);
|
|
|
e9710e |
- */
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_set_url(urconf, concat_path_file(portal_url, "/telemetry/abrt"));
|
|
|
e9710e |
- urconf->ur_ssl_verify = ssl_verify;
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_set_basic_auth(urconf, login, password);
|
|
|
e9710e |
-
|
|
|
e9710e |
- bool include_auth = true;
|
|
|
e9710e |
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "IncludeAuthData", include_auth, string_to_bool);
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (include_auth)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- const char *auth_items = NULL;
|
|
|
e9710e |
- UREPORT_OPTION_VALUE_FROM_CONF(settings, "AuthDataItems", auth_items, (const char *));
|
|
|
e9710e |
- urconf->ur_prefs.urp_auth_items = parse_list(auth_items);
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- urconf->ur_prefs.urp_flags |= UREPORT_PREF_FLAG_RETURN_ON_FAILURE;
|
|
|
e9710e |
-}
|
|
|
e9710e |
-
|
|
|
e9710e |
static char *create_case_url(char *url, const char *case_no)
|
|
|
e9710e |
{
|
|
|
e9710e |
char *url1 = concat_path_file(url, RHTSUPPORT_CASE_URL_PATH);
|
|
|
e9710e |
@@ -496,7 +370,6 @@ int main(int argc, char **argv)
|
|
|
e9710e |
const char *dump_dir_name = ".";
|
|
|
e9710e |
const char *case_no = NULL;
|
|
|
e9710e |
GList *conf_file = NULL;
|
|
|
e9710e |
- const char *urconf_file = UREPORT_CONF_FILE_PATH;
|
|
|
e9710e |
const char *fmt_file = NULL;
|
|
|
e9710e |
|
|
|
e9710e |
/* Can't keep these strings/structs static: _() doesn't support that */
|
|
|
e9710e |
@@ -524,10 +397,6 @@ int main(int argc, char **argv)
|
|
|
e9710e |
"\n"
|
|
|
e9710e |
"Option -tCASE uploads FILEs to the case CASE on RHTSupport site.\n"
|
|
|
e9710e |
"-d DIR is ignored.\n"
|
|
|
e9710e |
- "\n"
|
|
|
e9710e |
- "Option -u sends ABRT crash statistics data (uReport) before creating a new case.\n"
|
|
|
e9710e |
- "uReport configuration is loaded from UR_CONFFILE which defaults to\n"
|
|
|
e9710e |
- UREPORT_CONF_FILE_PATH".\n"
|
|
|
e9710e |
);
|
|
|
e9710e |
enum {
|
|
|
e9710e |
OPT_v = 1 << 0,
|
|
|
e9710e |
@@ -547,8 +416,6 @@ int main(int argc, char **argv)
|
|
|
e9710e |
OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")),
|
|
|
e9710e |
OPT_OPTSTRING('t', NULL, &case_no , "ID" , _("Upload FILEs [to case with this ID]")),
|
|
|
e9710e |
OPT_BOOL( 'f', NULL, NULL , _("Force reporting even if this problem is already reported")),
|
|
|
e9710e |
- OPT_BOOL( 'u', NULL, NULL , _("Submit uReport before creating a new case")),
|
|
|
e9710e |
- OPT_STRING( 'C', NULL, &urconf_file , "FILE", _("Configuration file for uReport")),
|
|
|
e9710e |
OPT_STRING( 'F', NULL, &fmt_file , "FILE", _("Formatting file for a new case")),
|
|
|
e9710e |
OPT_BOOL( 'D', NULL, NULL , _("Debug")),
|
|
|
e9710e |
OPT_END()
|
|
|
e9710e |
@@ -607,22 +474,10 @@ int main(int argc, char **argv)
|
|
|
e9710e |
/* RH has a 250m limit for web attachments (as of 2013) */
|
|
|
e9710e |
envvar ? envvar : (get_map_string_item_or_NULL(settings, "BigSizeMB") ? : "200")
|
|
|
e9710e |
);
|
|
|
e9710e |
- envvar = getenv("RHTSupport_SubmitUReport");
|
|
|
e9710e |
- bool submit_ur = string_to_bool(
|
|
|
e9710e |
- envvar ? envvar :
|
|
|
e9710e |
- (get_map_string_item_or_NULL(settings, "SubmitUReport") ? :
|
|
|
e9710e |
- ((opts & OPT_u) ? "1" : "0"))
|
|
|
e9710e |
- );
|
|
|
e9710e |
+
|
|
|
e9710e |
free_map_string(settings);
|
|
|
e9710e |
|
|
|
e9710e |
char *base_api_url = xstrdup(url);
|
|
|
e9710e |
- char *bthash = NULL;
|
|
|
e9710e |
-
|
|
|
e9710e |
- map_string_t *ursettings = new_map_string();
|
|
|
e9710e |
- struct ureport_server_config urconf;
|
|
|
e9710e |
-
|
|
|
e9710e |
- prepare_ureport_configuration(urconf_file, ursettings, &urconf,
|
|
|
e9710e |
- url, login, password, ssl_verify);
|
|
|
e9710e |
|
|
|
e9710e |
if (opts & OPT_t)
|
|
|
e9710e |
{
|
|
|
e9710e |
@@ -697,17 +552,6 @@ int main(int argc, char **argv)
|
|
|
e9710e |
return 0;
|
|
|
e9710e |
}
|
|
|
e9710e |
free_report_result(reported_to);
|
|
|
e9710e |
-
|
|
|
e9710e |
- if (submit_ur)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_warning(_("Sending ABRT crash statistics data"));
|
|
|
e9710e |
-
|
|
|
e9710e |
- bthash = submit_ureport(dump_dir_name, &urconf);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* Ensure that we will use the updated credentials */
|
|
|
e9710e |
- STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
|
|
|
e9710e |
- STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
|
|
|
e9710e |
- }
|
|
|
e9710e |
}
|
|
|
e9710e |
|
|
|
e9710e |
problem_data_t *problem_data = create_problem_data_for_reporting(dump_dir_name);
|
|
|
e9710e |
@@ -930,30 +774,6 @@ int main(int argc, char **argv)
|
|
|
e9710e |
}
|
|
|
e9710e |
/* else: error msg was already emitted by dd_opendir */
|
|
|
e9710e |
|
|
|
e9710e |
- if (bthash)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_warning(_("Linking ABRT crash statistics record with the case"));
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* Make sure we use the current credentials */
|
|
|
e9710e |
- ureport_server_config_set_basic_auth(&urconf, login, password);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* Attach Customer Case ID*/
|
|
|
e9710e |
- attach_to_ureport(&urconf, bthash, "RHCID", result->url);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* Attach Contact e-mail if configured */
|
|
|
e9710e |
- const char *email = NULL;
|
|
|
e9710e |
- UREPORT_OPTION_VALUE_FROM_CONF(ursettings, "ContactEmail", email, (const char *));
|
|
|
e9710e |
- if (email != NULL)
|
|
|
e9710e |
- {
|
|
|
e9710e |
- log_warning(_("Linking ABRT crash statistics record with contact email: '%s'"), email);
|
|
|
e9710e |
- attach_to_ureport(&urconf, bthash, "email", email);
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* Update the credentials */
|
|
|
e9710e |
- STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
|
|
|
e9710e |
- STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
url = result->url;
|
|
|
e9710e |
result->url = NULL;
|
|
|
e9710e |
free_rhts_result(result);
|
|
|
e9710e |
@@ -1021,10 +841,6 @@ int main(int argc, char **argv)
|
|
|
e9710e |
free_rhts_result(result_atch);
|
|
|
e9710e |
free_rhts_result(result);
|
|
|
e9710e |
|
|
|
e9710e |
- ureport_server_config_destroy(&urconf);
|
|
|
e9710e |
- free_map_string(ursettings);
|
|
|
e9710e |
- free(bthash);
|
|
|
e9710e |
-
|
|
|
e9710e |
free(base_api_url);
|
|
|
e9710e |
free(url);
|
|
|
e9710e |
free(login);
|
|
|
e9710e |
diff --git a/src/plugins/ureport.conf b/src/plugins/ureport.conf
|
|
|
e9710e |
index 04dc100..11f4531 100644
|
|
|
e9710e |
--- a/src/plugins/ureport.conf
|
|
|
e9710e |
+++ b/src/plugins/ureport.conf
|
|
|
e9710e |
@@ -22,8 +22,6 @@
|
|
|
e9710e |
# 'IncludeAuthData' to 'yes'.
|
|
|
e9710e |
# None (default):
|
|
|
e9710e |
# SSLClientAuth =
|
|
|
e9710e |
-# Using RH subscription management consumer certificate:
|
|
|
e9710e |
-# SSLClientAuth = rhsm
|
|
|
e9710e |
# Using Puppet certificate:
|
|
|
e9710e |
# SSLClientAuth = puppet
|
|
|
e9710e |
# Using custom certificate:
|
|
|
e9710e |
@@ -32,8 +30,6 @@
|
|
|
e9710e |
# HTTP Basic authentication credentials.
|
|
|
e9710e |
# Assingning any value to 'HTTPAuth' changes the default value of
|
|
|
e9710e |
# 'IncludeAuthData' to 'yes'.
|
|
|
e9710e |
-# Use Login= and Password= from /etc/libreport/plugins/rhtsupport.conf:
|
|
|
e9710e |
-# HTTPAuth = rhts-credentials
|
|
|
e9710e |
# Use username and password:
|
|
|
e9710e |
# HTTPAuth = username:password
|
|
|
e9710e |
|
|
|
e9710e |
diff --git a/tests/ureport.at b/tests/ureport.at
|
|
|
e9710e |
index ecaa3dd..51ca0c2 100644
|
|
|
e9710e |
--- a/tests/ureport.at
|
|
|
e9710e |
+++ b/tests/ureport.at
|
|
|
e9710e |
@@ -250,73 +250,6 @@ int main(void)
|
|
|
e9710e |
ureport_server_config_destroy(&config);
|
|
|
e9710e |
free_map_string(settings);
|
|
|
e9710e |
|
|
|
e9710e |
- /* value from env */
|
|
|
e9710e |
- /* HTTPAuth set to 'username:password' */
|
|
|
e9710e |
- /* SSLClientAuth set to 'rhsm' */
|
|
|
e9710e |
- ureport_server_config_init(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
- settings = new_map_string();
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("uReport_SSLClientAuth", "rhsm", 1);
|
|
|
e9710e |
- setenv("uReport_HTTPAuth", "username:password", 1);
|
|
|
e9710e |
- setenv("uReport_AuthDataItems", "hostname, time", 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_CORRECT_DIR_PATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_load(&config, settings);
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert(strcmp(config.ur_username, "username") == 0);
|
|
|
e9710e |
- assert(strcmp(config.ur_password, "password") == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert(config.ur_client_cert == NULL);
|
|
|
e9710e |
- assert(config.ur_client_key == NULL);
|
|
|
e9710e |
- assert(size_map_string(config.ur_http_headers) == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- l = config.ur_prefs.urp_auth_items;
|
|
|
e9710e |
- assert(strcmp(l->data, "hostname") == 0);
|
|
|
e9710e |
- assert(strcmp(l->next->data, "time") == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
|
|
|
e9710e |
-
|
|
|
e9710e |
- unsetenv("uReport_SSLClientAuth");
|
|
|
e9710e |
- unsetenv("uReport_HTTPAuth");
|
|
|
e9710e |
- unsetenv("uReport_AuthDataItems");
|
|
|
e9710e |
-
|
|
|
e9710e |
- free_map_string(settings);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_destroy(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* value from settings */
|
|
|
e9710e |
- /* HTTPAuth set to 'username:password' */
|
|
|
e9710e |
- /* SSLClientAuth set to 'rhsm' */
|
|
|
e9710e |
- ureport_server_config_init(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
- settings = new_map_string();
|
|
|
e9710e |
- insert_map_string(settings, xstrdup("SSLClientAuth"), xstrdup("rhsm"));
|
|
|
e9710e |
- insert_map_string(settings, xstrdup("HTTPAuth"), xstrdup("rhn-username:rhn-password"));
|
|
|
e9710e |
- insert_map_string(settings, xstrdup("AuthDataItems"), xstrdup("hostname, type"));
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_CORRECT_DIR_PATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_load(&config, settings);
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert(strcmp(config.ur_username, "rhn-username") == 0);
|
|
|
e9710e |
- assert(strcmp(config.ur_password, "rhn-password") == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert(config.ur_client_cert == NULL);
|
|
|
e9710e |
- assert(config.ur_client_key == NULL);
|
|
|
e9710e |
- assert(size_map_string(config.ur_http_headers) == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- l = config.ur_prefs.urp_auth_items;
|
|
|
e9710e |
- assert(strcmp(l->data, "hostname") == 0);
|
|
|
e9710e |
- assert(strcmp(l->next->data, "type") == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
|
|
|
e9710e |
-
|
|
|
e9710e |
- free_map_string(settings);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_destroy(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
return 0;
|
|
|
e9710e |
}
|
|
|
e9710e |
]])
|
|
|
e9710e |
@@ -366,7 +299,6 @@ AT_TESTFUN([ureport_server_config_set_client_auth],
|
|
|
e9710e |
#include <assert.h>
|
|
|
e9710e |
|
|
|
e9710e |
#define DESTROYED_POINTER (void *)0xdeadbeef
|
|
|
e9710e |
-#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt"
|
|
|
e9710e |
|
|
|
e9710e |
#define TESTING_CERTS_CORRECT_DIR_PATH "../../ureport/certs/correct"
|
|
|
e9710e |
#define TESTING_CERTS_INCORRECT_ONLY_CERT_DIR_PATH "../../ureport/certs/only_cert"
|
|
|
e9710e |
@@ -374,10 +306,6 @@ AT_TESTFUN([ureport_server_config_set_client_auth],
|
|
|
e9710e |
#define TESTING_PYTHONPATH "../../ureport/"
|
|
|
e9710e |
#define WRONG_TESTING_PYTHONPATH "../../ureportxxxxxx/"
|
|
|
e9710e |
|
|
|
e9710e |
-#define RHSMCON_PEM_DIR_PATH "/etc/pki/consumer"
|
|
|
e9710e |
-#define RHSMCON_CERT_NAME "cert.pem"
|
|
|
e9710e |
-#define RHSMCON_KEY_NAME "key.pem"
|
|
|
e9710e |
-
|
|
|
e9710e |
char *my_strdup(const char *str)
|
|
|
e9710e |
{
|
|
|
e9710e |
if (str == NULL)
|
|
|
e9710e |
@@ -500,52 +428,6 @@ int main(void)
|
|
|
e9710e |
|
|
|
e9710e |
ureport_server_config_destroy(&config);
|
|
|
e9710e |
|
|
|
e9710e |
- /* client_auth == rhsm */
|
|
|
e9710e |
- /* ur_url == NULL */
|
|
|
e9710e |
- /* no certs */
|
|
|
e9710e |
- char *empty_cert_dir = mkdtemp(strdup("/tmp/cert_XXXXXX"));
|
|
|
e9710e |
- assert(empty_cert_dir);
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", empty_cert_dir, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- int status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
|
|
|
e9710e |
- assert(status == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert(rmdir(empty_cert_dir) == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* client_auth == rhsm */
|
|
|
e9710e |
- /* ur_url == NULL */
|
|
|
e9710e |
- /* certs exists (only RHSMCON_CERT_NAME exists) */
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_INCORRECT_ONLY_CERT_DIR_PATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
|
|
|
e9710e |
- assert(status == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* client_auth == rhsm */
|
|
|
e9710e |
- /* ur_url == NULL */
|
|
|
e9710e |
- /* certs exists (only RHSMCON_KEY_NAME exists) */
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_INCORRECT_ONLY_KEY_DIR_PATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
|
|
|
e9710e |
- assert(status == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* client_auth == rhsm */
|
|
|
e9710e |
- /* ur_url == NULL */
|
|
|
e9710e |
- /* certs exists (correct) */
|
|
|
e9710e |
- ureport_server_config_init(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", TESTING_CERTS_CORRECT_DIR_PATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_set_client_auth(&config, "rhsm");
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert_ureport_server_config(&config, RHSM_WEB_SERVICE_URL, true,
|
|
|
e9710e |
- TESTING_CERTS_CORRECT_DIR_PATH"/cert.pem",
|
|
|
e9710e |
- TESTING_CERTS_CORRECT_DIR_PATH"/key.pem",
|
|
|
e9710e |
- NULL, NULL);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_destroy(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
/* client_auth == cert:key */
|
|
|
e9710e |
/* ur_url == NULL */
|
|
|
e9710e |
ureport_server_config_init(&config);
|
|
|
e9710e |
@@ -572,44 +454,6 @@ int main(void)
|
|
|
e9710e |
ret_val = test_ureport_server_config_set_client_auth_exit_code(&config, "cert");
|
|
|
e9710e |
assert(ret_val != 0 && ret_val != -1);
|
|
|
e9710e |
|
|
|
e9710e |
-/* rhsm_config_get_consumer_cert_dir */
|
|
|
e9710e |
-/* certs exists (correct content) */
|
|
|
e9710e |
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
|
|
|
e9710e |
- setenv("PYTHONPATH", TESTING_PYTHONPATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_init(&config);
|
|
|
e9710e |
- ureport_server_config_set_client_auth(&config, "rhsm");
|
|
|
e9710e |
-
|
|
|
e9710e |
- char *abs_path_cert = realpath(TESTING_CERTS_CORRECT_DIR_PATH"/cert.pem", NULL);
|
|
|
e9710e |
- char *abs_path_key = realpath(TESTING_CERTS_CORRECT_DIR_PATH"/key.pem", NULL);
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert_ureport_server_config(&config, RHSM_WEB_SERVICE_URL, true,
|
|
|
e9710e |
- abs_path_cert,
|
|
|
e9710e |
- abs_path_key,
|
|
|
e9710e |
- NULL, NULL);
|
|
|
e9710e |
- free(abs_path_cert);
|
|
|
e9710e |
- free(abs_path_key);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_destroy(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* python script fails, '/etc/pki/consumer' is returned */
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* set cert dir path to '/etc/pki/consumer' */
|
|
|
e9710e |
- /* store return value of ureport_server_config_set_client_auth */
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH", RHSMCON_PEM_DIR_PATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- int exp_ret_val = test_ureport_server_config_set_client_auth_exit_code(&config, "rhsm");
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* Do the same with unset LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH and wrong PYTHONPATH */
|
|
|
e9710e |
- /* function rhsm_config_get_consumer_cert_dir has to return RHSMCON_PEM_DIR_PATH */
|
|
|
e9710e |
- unsetenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH");
|
|
|
e9710e |
- setenv("PYTHONPATH", WRONG_TESTING_PYTHONPATH, 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- int rec_ret_val = test_ureport_server_config_set_client_auth_exit_code(&config, "rhsm");
|
|
|
e9710e |
-
|
|
|
e9710e |
- /* we expect the same return value */
|
|
|
e9710e |
-// assert(exp_ret_val == rec_ret_val);
|
|
|
e9710e |
-
|
|
|
e9710e |
return 0;
|
|
|
e9710e |
}
|
|
|
e9710e |
]])
|
|
|
e9710e |
@@ -1208,8 +1052,6 @@ AT_TESTFUN([ureport_server_config_load_basic_auth],
|
|
|
e9710e |
#include "libreport_curl.h"
|
|
|
e9710e |
#include "problem_data.h"
|
|
|
e9710e |
|
|
|
e9710e |
-#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt"
|
|
|
e9710e |
-
|
|
|
e9710e |
int main(void)
|
|
|
e9710e |
{
|
|
|
e9710e |
g_verbose=3;
|
|
|
e9710e |
@@ -1226,22 +1068,6 @@ int main(void)
|
|
|
e9710e |
ureport_server_config_destroy(&config);
|
|
|
e9710e |
}
|
|
|
e9710e |
|
|
|
e9710e |
- {
|
|
|
e9710e |
- struct ureport_server_config config;
|
|
|
e9710e |
- ureport_server_config_init(&config);
|
|
|
e9710e |
-
|
|
|
e9710e |
- setenv("LIBREPORT_DEBUG_PLUGINS_CONF_DIR", "../../ureport-rhts-credentials/", 1);
|
|
|
e9710e |
-
|
|
|
e9710e |
- ureport_server_config_load_basic_auth(&config, "rhts-credentials");
|
|
|
e9710e |
-
|
|
|
e9710e |
- assert(strcmp(config.ur_username, "rhn-user-name") == 0);
|
|
|
e9710e |
- assert(strcmp(config.ur_password, "rhn-password") == 0);
|
|
|
e9710e |
- assert(strcmp(config.ur_url, RHSM_WEB_SERVICE_URL) == 0);
|
|
|
e9710e |
-
|
|
|
e9710e |
- unsetenv("LIBREPORT_DEBUG_PLUGINS_CONF_DIR");
|
|
|
e9710e |
- ureport_server_config_destroy(&config);
|
|
|
e9710e |
- }
|
|
|
e9710e |
-
|
|
|
e9710e |
{
|
|
|
e9710e |
pid_t pid = fork();
|
|
|
e9710e |
if (pid < 0)
|
|
|
e9710e |
diff --git a/tests/ureport/rhsm/__init__.py b/tests/ureport/rhsm/__init__.py
|
|
|
e9710e |
deleted file mode 100644
|
|
|
e9710e |
index e69de29..0000000
|
|
|
e9710e |
diff --git a/tests/ureport/rhsm/config.py b/tests/ureport/rhsm/config.py
|
|
|
e9710e |
deleted file mode 100644
|
|
|
e9710e |
index 44483d8..0000000
|
|
|
e9710e |
--- a/tests/ureport/rhsm/config.py
|
|
|
e9710e |
+++ /dev/null
|
|
|
e9710e |
@@ -1,8 +0,0 @@
|
|
|
e9710e |
-import os
|
|
|
e9710e |
-
|
|
|
e9710e |
-def initConfig():
|
|
|
e9710e |
- return myConfig()
|
|
|
e9710e |
-
|
|
|
e9710e |
-class myConfig():
|
|
|
e9710e |
- def get(self, key, value):
|
|
|
e9710e |
- return os.path.abspath("../../ureport/certs/correct")
|