From 646101d558765b59bae94aa27bfbefed3a085ab5 Mon Sep 17 00:00:00 2001 From: Ernestas Kulik Date: Tue, 2 Jun 2020 10:57:36 +0200 Subject: [PATCH] ureport: Drop Strata integration Strata is being sunset with no replacement for our used API endpoints in sight. This commit drops the integration code, because no one pretty much wants it, either. --- configure.ac | 11 -- doc/reporter-rhtsupport.txt | 17 -- doc/reporter-ureport.txt | 8 - src/include/ureport.h | 4 +- src/lib/ureport.c | 138 +-------------- src/plugins/Makefile.am | 6 - src/plugins/cert-api.access.redhat.com.pem | 74 -------- src/plugins/report_RHTSupport.xml.in | 5 - src/plugins/reporter-rhtsupport.c | 186 +-------------------- src/plugins/ureport.conf | 4 - tests/ureport.at | 174 ------------------- tests/ureport/rhsm/__init__.py | 0 tests/ureport/rhsm/config.py | 8 - 13 files changed, 7 insertions(+), 628 deletions(-) delete mode 100644 src/plugins/cert-api.access.redhat.com.pem delete mode 100644 tests/ureport/rhsm/__init__.py delete mode 100644 tests/ureport/rhsm/config.py diff --git a/configure.ac b/configure.ac index ce45389..ef35f84 100644 --- a/configure.ac +++ b/configure.ac @@ -172,17 +172,6 @@ do done fi dnl end NO_MANTISBT -dnl enable import of certificate for rhtsupport plugin -AC_ARG_ENABLE([import-rhtsupport-cert], -AS_HELP_STRING([--enable-import-rhtsupport-cert], - [import certificate needed for rhtsupport plugin (default is NO)]), -[], [enable_import_rhtsupport_cert="no"]) - -AS_IF([test "x$enable_import_rhtsupport_cert" != "xno"], -AM_CONDITIONAL(ENABLE_IMPORT_RHTSUPPORT_CERT, true), -AM_CONDITIONAL(ENABLE_IMPORT_RHTSUPPORT_CERT, false)) - - AC_ARG_WITH(python2, AS_HELP_STRING([--with-python2],[use python2 (default is YES)]), LIBREPORT_PARSE_WITH([python2])) diff --git a/doc/reporter-rhtsupport.txt b/doc/reporter-rhtsupport.txt index e52a152..132c0ea 100644 --- a/doc/reporter-rhtsupport.txt +++ b/doc/reporter-rhtsupport.txt @@ -18,9 +18,6 @@ DESCRIPTION The tool reads problem directory DIR. Then it logs in to RHTSupport and creates a new case. -The tool can be configured to submit an uReport to RHTSupport together with -creating a new case. - The URL to new case is printed to stdout and recorded in 'reported_to' element in DIR. @@ -36,10 +33,6 @@ to enter case ID to which you want to upload the FILEs. Option -tCASE uploads FILEs to the case CASE on RHTSupport site. -d DIR is ignored. -Option -u uploads uReport along with creating a new case. uReport configuration -is loaded from UR_CONFFILE which defaults to -/etc/libreport/plugins/ureport.conf. - Configuration file ~~~~~~~~~~~~~~~~~~ Configuration file lines should have 'PARAM = VALUE' format. The parameters are: @@ -56,10 +49,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are: 'SSLVerify':: Use yes/true/on/1 to verify server's SSL certificate. (default: yes) -'SubmitUReport':: - Use yes/true/on/1 to enable submitting uReport together wit creating a new - case. (default: no) - Parameters can be overridden via $RHTSupport_PARAM environment variables. Integration with ABRT events @@ -84,12 +73,6 @@ OPTIONS -t[ID]:: Upload FILEs to the already created case on RHTSupport site. --u:: - Submit uReport together with creating a new case. - --C UR_CONFFILE:: - Configuration file for submitting uReports. - -F CONF_FORMAT_FILE:: Formatting file for a new case. diff --git a/doc/reporter-ureport.txt b/doc/reporter-ureport.txt index 7deb911..fc06541 100644 --- a/doc/reporter-ureport.txt +++ b/doc/reporter-ureport.txt @@ -34,10 +34,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are: Possible values are: - 'rhsm';; - Uses the system V3 entitlement certificate that is used for Red Hat - subscription management. - 'puppet';; Uses the certificate that is used by the Puppet configuration management tool. @@ -51,10 +47,6 @@ Configuration file lines should have 'PARAM = VALUE' format. The parameters are: Possible values are:: - 'rhts-credentials';; - Uses Login= and Password= values from /etc/libreport/plugins/rhtsupport.conf and - user's local ~/.config/libreport/rhtsupport.conf. - ':';; Manually supply credentials. diff --git a/src/include/ureport.h b/src/include/ureport.h index 63d9bf2..2e6de49 100644 --- a/src/include/ureport.h +++ b/src/include/ureport.h @@ -115,8 +115,7 @@ ureport_server_config_set_url(struct ureport_server_config *config, * Configure client certificate paths * * @param config Where the paths are stored - * @param client_path Path in form of cert_full_path:key_full_path or one of - * the following string: 'rhsm', 'puppet'. + * @param client_path Path in form of cert_full_path:key_full_path or 'puppet'. */ #define ureport_server_config_set_client_auth libreport_ureport_server_config_set_client_auth void @@ -139,7 +138,6 @@ ureport_server_config_set_basic_auth(struct ureport_server_config *config, * Configure user name and password for HTTP Basic authentication according to * user preferences. * - * "rhts-credentials" - Uses Login= and Password= from rhtsupport.conf * ":" - Manually supply user name and password. * "" - Manually supply user name and be asked for password. * diff --git a/src/lib/ureport.c b/src/lib/ureport.c index ced4810..5d0a820 100644 --- a/src/lib/ureport.c +++ b/src/lib/ureport.c @@ -30,19 +30,6 @@ #define BTHASH_URL_SFX "reports/bthash/" -#define RHSM_WEB_SERVICE_URL "https://cert-api.access.redhat.com/rs/telemetry/abrt" - -#define RHSMCON_PEM_DIR_PATH "/etc/pki/consumer" -#define RHSMCON_CERT_NAME "cert.pem" -#define RHSMCON_KEY_NAME "key.pem" - -/* Using the same template as for RHSM certificate, macro for cert dir path and - * macro for cert name. Cert path can be easily modified for example by reading - * an environment variable LIBREPORT_DEBUG_AUTHORITY_CERT_DIR_PATH - */ -#define CERT_AUTHORITY_CERT_PATH "/etc/libreport" -#define CERT_AUTHORITY_CERT_NAME "cert-api.access.redhat.com.pem" - static char * puppet_config_print(const char *key) { @@ -73,55 +60,6 @@ ureport_server_config_set_url(struct ureport_server_config *config, config->ur_url = server_url; } -static char * -rhsm_config_get_consumer_cert_dir(void) -{ - char *result = getenv("LIBREPORT_DEBUG_RHSMCON_PEM_DIR_PATH"); - if (result != NULL) - return xstrdup(result); - - result = run_in_shell_and_save_output(0, - "python3 -c \"from rhsm.config import initConfig; print(initConfig().get('rhsm', 'consumerCertDir'))\"", - NULL, NULL); - - /* run_in_shell_and_save_output always returns non-NULL */ - if (result[0] != '/') - goto error; - - char *newline = strchrnul(result, '\n'); - if (!newline) - goto error; - - *newline = '\0'; - return result; -error: - free(result); - error_msg("Failed to get 'rhsm':'consumerCertDir' from rhsm.config python module. Using "RHSMCON_PEM_DIR_PATH); - return xstrdup(RHSMCON_PEM_DIR_PATH); -} - -static bool -certificate_exist(char *cert_name) -{ - if (access(cert_name, F_OK) != 0) - { - log_notice("RHSM consumer certificate '%s' does not exist.", cert_name); - return false; - } - return true; -} - -static bool -cert_authority_cert_exist(char *cert_name) -{ - if (access(cert_name, F_OK) != 0) - { - log_notice("Certs validating the server '%s' does not exist.", cert_name); - return false; - } - return true; -} - void ureport_server_config_set_client_auth(struct ureport_server_config *config, const char *client_auth) @@ -139,52 +77,6 @@ ureport_server_config_set_client_auth(struct ureport_server_config *config, log_notice("Not using client authentication"); } - else if (strcmp(client_auth, "rhsm") == 0) - { - if (config->ur_url == NULL) - ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL)); - - /* always returns non-NULL */ - char *rhsm_dir = rhsm_config_get_consumer_cert_dir(); - - char *cert_full_name = concat_path_file(rhsm_dir, RHSMCON_CERT_NAME); - char *key_full_name = concat_path_file(rhsm_dir, RHSMCON_KEY_NAME); - - /* get authority certificate dir path from environment variable, if it - * is not set, use CERT_AUTHORITY_CERT_PATH - */ - const char *authority_cert_dir_path = getenv("LIBREPORT_DEBUG_AUTHORITY_CERT_DIR_PATH"); - if (authority_cert_dir_path == NULL) - authority_cert_dir_path = CERT_AUTHORITY_CERT_PATH; - - char *cert_authority_cert_full_name = concat_path_file(authority_cert_dir_path, - CERT_AUTHORITY_CERT_NAME); - - if (certificate_exist(cert_full_name) && certificate_exist(key_full_name)) - { - config->ur_client_cert = cert_full_name; - config->ur_client_key = key_full_name; - log_debug("Using cert files: '%s' : '%s'", config->ur_client_cert, config->ur_client_key); - } - else - { - free(cert_full_name); - free(key_full_name); - log_notice("Using the default configuration for uReports."); - } - - if (cert_authority_cert_exist(cert_authority_cert_full_name)) - { - config->ur_cert_authority_cert = cert_authority_cert_full_name; - log_debug("Using validating server cert: '%s'", config->ur_cert_authority_cert); - } - else - { - free(cert_authority_cert_full_name); - } - - free(rhsm_dir); - } else if (strcmp(client_auth, "puppet") == 0) { config->ur_client_cert = puppet_config_print("hostcert"); @@ -241,32 +133,12 @@ ureport_server_config_load_basic_auth(struct ureport_server_config *config, const char *username = NULL; const char *password = NULL; - if (strcmp(http_auth_pref, "rhts-credentials") == 0) - { - settings = new_map_string(); - - char *local_conf = xasprintf("%s"USER_HOME_CONFIG_PATH"/rhtsupport.conf", getenv("HOME")); - - if (!load_plugin_conf_file("rhtsupport.conf", settings, /*skip key w/o values:*/ false) && - !load_conf_file(local_conf, settings, /*skip key w/o values:*/ false)) - error_msg_and_die("Could not get RHTSupport credentials"); - free(local_conf); - - username = get_map_string_item_or_NULL(settings, "Login"); - password = get_map_string_item_or_NULL(settings, "Password"); - - if (config->ur_url == NULL) - ureport_server_config_set_url(config, xstrdup(RHSM_WEB_SERVICE_URL)); - } - else - { - username = tmp_username = xstrdup(http_auth_pref); - password = strchr(tmp_username, ':'); + username = tmp_username = xstrdup(http_auth_pref); + password = strchr(tmp_username, ':'); - if (password != NULL) - /* It is "char *", see strchr() few lines above. */ - *((char *)(password++)) = '\0'; - } + if (password != NULL) + /* It is "char *", see strchr() few lines above. */ + *((char *)(password++)) = '\0'; if (password == NULL) { diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index b228602..f73e7dc 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -28,12 +28,6 @@ pluginsconfdir = $(PLUGINS_CONF_DIR) reportpluginsconfdir = $(REPORT_PLUGINS_CONF_DIR) -if ENABLE_IMPORT_RHTSUPPORT_CERT -libreportconfdir = $(CONF_DIR) -dist_libreportconf_DATA = \ - cert-api.access.redhat.com.pem -endif - reporters_plugin_conf = reporters_plugin_format_conf = if BUILD_BUGZILLA diff --git a/src/plugins/cert-api.access.redhat.com.pem b/src/plugins/cert-api.access.redhat.com.pem deleted file mode 100644 index 20ef8c0..0000000 --- a/src/plugins/cert-api.access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mgDpA5PcbvO -gl7OexNL4zcpyfMdAmTYf5yTRSvB42Yg5hVfuzPEnOIqupwES3mWkEHRlqbMUkHw -qIQAxIwQqZd5PdPpElQ/6j/ZT9DwW/I6zgndX2rsS0oGYcwFTkSj0/rKKkC13hk7 -LchXMZu5ckdustM79U6OZIBairrJaL2OpR08un2nwIjgEGqhVFYc44UK1VpkE8mr -qvqJS6OHVlTlKcEDnhVkPS3i5qjuS/PtSq0CwH8bzYKFJayLDY/z36Zv6PdttzmU -Yb1NSDcJejHJ80pMINutyYQ= ------END CERTIFICATE----- diff --git a/src/plugins/report_RHTSupport.xml.in b/src/plugins/report_RHTSupport.xml.in index 357a94d..c64cb55 100644 --- a/src/plugins/report_RHTSupport.xml.in +++ b/src/plugins/report_RHTSupport.xml.in @@ -26,11 +26,6 @@ no -