From 42c35440205e0174af21315277dedac76fb9c8ae Mon Sep 17 00:00:00 2001 From: Matej Habrnal Date: Fri, 24 Apr 2015 15:37:15 +0200 Subject: [PATCH] abrt-auto-reporting: require rhtsupport.conf file only on RHEL abrt-auto-reporting required the rhtsupport.conf on Fedora and CentOS but the conf file do not exists in those systems. Resolves abrt/abrt#957 Signed-off-by: Matej Habrnal --- configure.ac | 11 +++ doc/Makefile.am | 13 +++- doc/abrt-auto-reporting-authenticated.txt | 106 ++++++++++++++++++++++++++++ doc/abrt-auto-reporting-unauthenticated.txt | 71 +++++++++++++++++++ doc/abrt-auto-reporting.txt | 106 ---------------------------- src/daemon/abrt-auto-reporting.c | 71 ++++++++++++++----- 6 files changed, 254 insertions(+), 124 deletions(-) create mode 100644 doc/abrt-auto-reporting-authenticated.txt create mode 100644 doc/abrt-auto-reporting-unauthenticated.txt delete mode 100644 doc/abrt-auto-reporting.txt diff --git a/configure.ac b/configure.ac index d95fc4a..d65bf54 100644 --- a/configure.ac +++ b/configure.ac @@ -207,6 +207,17 @@ AC_ARG_ENABLE(suggest-autoreporting, AM_CONDITIONAL(SUGGEST_AUTOREPORTING, test "$enable_suggest_autoreporting" = "yes") +# Authenticated autoreporting + +AC_ARG_ENABLE(authenticated-autoreporting, + AS_HELP_STRING([--enable-authenticated-autoreporting], + [enable authenticated autoreporting]), + [enable_authenticated_autoreporting=$enableval], + [enable_authenticated_autoreporting=no] +) + +AM_CONDITIONAL(AUTHENTICATED_AUTOREPORTING, test "$enable_authenticated_autoreporting" = "yes") + # Make satyr use GDB or elfutils/libunwind for unwinding? AC_ARG_ENABLE([native-unwinder], diff --git a/doc/Makefile.am b/doc/Makefile.am index 0480114..309a330 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -71,6 +71,17 @@ man1_MANS = ${MAN1_TXT:%.txt=%.1} man5_MANS = ${MAN5_TXT:%.txt=%.5} ${MAN5_PREFORMATTED} man8_MANS = ${MAN8_TXT:%.txt=%.8} +MAN_SOURCE = +MAN_SOURCE = abrt-auto-reporting-authenticated.txt +MAN_SOURCE = abrt-auto-reporting-unauthenticated.txt + +if AUTHENTICATED_AUTOREPORTING +abrt-auto-reporting.txt: abrt-auto-reporting-authenticated.txt +else +abrt-auto-reporting.txt: abrt-auto-reporting-unauthenticated.txt +endif + cp $< $@ + %.1 %.5 %.8: %.xml $(XMLTO_SILENT) xmlto man $< 2>&1 | sed '/Note/d' @@ -79,6 +90,6 @@ man8_MANS = ${MAN8_TXT:%.txt=%.8} --conf-file ../asciidoc.conf \ -aabrt_version=$(PACKAGE_VERSION) -o $@ $< -EXTRA_DIST = $(MAN1_TXT) $(MAN5_TXT) $(MAN8_TXT) $(MAN5_PREFORMATTED) +EXTRA_DIST = $(MAN1_TXT) $(MAN5_TXT) $(MAN8_TXT) $(MAN5_PREFORMATTED) $(MAN_SOURCE) CLEANFILES = ${MAN1_TXT:%.txt=%.1} ${MAN5_TXT:%.txt=%.5} ${MAN8_TXT:%.txt=%.8} diff --git a/doc/abrt-auto-reporting-authenticated.txt b/doc/abrt-auto-reporting-authenticated.txt new file mode 100644 index 0000000..2a27945 --- /dev/null +++ b/doc/abrt-auto-reporting-authenticated.txt @@ -0,0 +1,106 @@ +abrt-auto-reporting(1) +====================== + +NAME +---- +abrt-auto-reporting - Get or modify the auto reporting option values + +SYNOPSIS +-------- +'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ] + [ [--anonymous] | + [--username USERNAME [--password PASSWORD] ] | + [--certificate SOURCE] ] + +DESCRIPTION +----------- +Reads the configuration from abrt.conf and saves the changes to the same file. + +The changes will take effect immediately without necessity to restart any ABRT +process and will be persistent. + +'disabled':: + User have to report the detect problems manually + +'enabled':: + ABRT uploads an uReport which was generated for a detected problem + immediately after the detection phase. + +Reads and saves the authentication configuration options in +/etc/libreport/plugins/ureport.conf and /etc/libreport/plugins/rhtsupport.conf + +uReport description +~~~~~~~~~~~~~~~~~~~ +ABRT supports uReports for four types of crashes: crashes of C/C++ programs +that result in a core dump, uncaught Python exceptions, uncaught Java +exceptions and kernel oopses. + +Each uReport generally contains a stack trace, or multiple stack traces in the +case of multi-threaded C/C++ and Java programs. The stack trace only describes +the call stack of the program at the time of the crash and does not contain +contents of any variables. + +Every uReport also contains identification of the operating system, versions of +the RPM packages involved in the crash, and whether the program ran under a +root user. + +There are also items specific to each crash type: + +C/C++ crashes:: + these are path to the executable and signal delivered to the program, + +Python exceptions:: + there is the type of the exception (without the error message, which may + contain sensitive data), + +for kernel oopses:: + these are list of loaded kernel modules, list of taint flags, and full text + of the kernel oops. + +The authenticated uReports also contains *hostname* and *machineid* to enable a +server side filtering at https://access.redhat.com/. + +The authenticated uReports have the benefit of rich server replies which may +include a solution for the submitted crash. The authentication is done using +either Red Hat Subscription Certificates or Red Hat Customer Portal +credentials. + +'Warning': +The full text of a kernel oops might contain information like the +identification of the host hardware type. You should disable the autoreporting +feature if you do not want to share this information with Red Hat. + + +OPTIONS +------- +-v, --verbose:: + Be more verbose. Can be given multiple times. + +-a, --anonymous:: + Turns the authentication off by clearing both 'SSLClientAuth' and 'HTTPAuth' + configuration options in /etc/libreport/plugins/ureport.conf + +-u, --username USERNAME:: + Turns HTTP Authentication on by setting 'HTTPAuth' configuration option to + *rhts-credentials* in /etc/libreport/plugins/ureport.conf and storing + USERNAME and PASSWORD in /etc/libreport/plugins/rhtsupport.conf + Also turns the SSL Client Authentication off, because these methods cannot + be used together. + +-p, --password PASSWORD:: + Password for HTTP Authentication. If not provided, a prompt asking for it + will be issued. + +-c, --certificate SOURCE:: + Turns SSL Client Authentication on by setting 'SSLClientAuth' configuration + option to SOURCE in /etc/libreport/plugins/ureport.conf. + Also turns the HTTP Authentication off, because these methods cannot + be used together. + +SEE ALSO +-------- +abrt.conf(5), ureport.conf(5), rhtsupport.conf(5) + +AUTHORS +------- +* ABRT team diff --git a/doc/abrt-auto-reporting-unauthenticated.txt b/doc/abrt-auto-reporting-unauthenticated.txt new file mode 100644 index 0000000..320c803 --- /dev/null +++ b/doc/abrt-auto-reporting-unauthenticated.txt @@ -0,0 +1,71 @@ +abrt-auto-reporting(1) +====================== + +NAME +---- +abrt-auto-reporting - Get or modify the auto reporting option values + +SYNOPSIS +-------- +'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ] + +DESCRIPTION +----------- +Reads the configuration from abrt.conf and saves the changes to the same file. + +The changes will take effect immediately without necessity to restart any ABRT +process and will be persistent. + +'disabled':: + User have to report the detect problems manually + +'enabled':: + ABRT uploads an uReport which was generated for a detected problem + immediately after the detection phase. + +uReport description +~~~~~~~~~~~~~~~~~~~ +ABRT supports uReports for four types of crashes: crashes of C/C++ programs +that result in a core dump, uncaught Python exceptions, uncaught Java +exceptions and kernel oopses. + +Each uReport generally contains a stack trace, or multiple stack traces in the +case of multi-threaded C/C++ and Java programs. The stack trace only describes +the call stack of the program at the time of the crash and does not contain +contents of any variables. + +Every uReport also contains identification of the operating system, versions of +the RPM packages involved in the crash, and whether the program ran under a +root user. + +There are also items specific to each crash type: + +C/C++ crashes:: + these are path to the executable and signal delivered to the program, + +Python exceptions:: + there is the type of the exception (without the error message, which may + contain sensitive data), + +for kernel oopses:: + these are list of loaded kernel modules, list of taint flags, and full text + of the kernel oops. + +'Warning': +The full text of a kernel oops might contain information like the +identification of the host hardware type. You should disable the autoreporting +feature if you do not want to share this information with Red Hat. + + +OPTIONS +------- +-v, --verbose:: + Be more verbose. Can be given multiple times. + +SEE ALSO +-------- +abrt.conf(5) + +AUTHORS +------- +* ABRT team diff --git a/doc/abrt-auto-reporting.txt b/doc/abrt-auto-reporting.txt deleted file mode 100644 index 2a27945..0000000 --- a/doc/abrt-auto-reporting.txt +++ /dev/null @@ -1,106 +0,0 @@ -abrt-auto-reporting(1) -====================== - -NAME ----- -abrt-auto-reporting - Get or modify the auto reporting option values - -SYNOPSIS --------- -'abrt-auto-reporting' [-v] [ enabled | yes | 1 | on | disabled | no | 0 | off ] - [ [--anonymous] | - [--username USERNAME [--password PASSWORD] ] | - [--certificate SOURCE] ] - -DESCRIPTION ------------ -Reads the configuration from abrt.conf and saves the changes to the same file. - -The changes will take effect immediately without necessity to restart any ABRT -process and will be persistent. - -'disabled':: - User have to report the detect problems manually - -'enabled':: - ABRT uploads an uReport which was generated for a detected problem - immediately after the detection phase. - -Reads and saves the authentication configuration options in -/etc/libreport/plugins/ureport.conf and /etc/libreport/plugins/rhtsupport.conf - -uReport description -~~~~~~~~~~~~~~~~~~~ -ABRT supports uReports for four types of crashes: crashes of C/C++ programs -that result in a core dump, uncaught Python exceptions, uncaught Java -exceptions and kernel oopses. - -Each uReport generally contains a stack trace, or multiple stack traces in the -case of multi-threaded C/C++ and Java programs. The stack trace only describes -the call stack of the program at the time of the crash and does not contain -contents of any variables. - -Every uReport also contains identification of the operating system, versions of -the RPM packages involved in the crash, and whether the program ran under a -root user. - -There are also items specific to each crash type: - -C/C++ crashes:: - these are path to the executable and signal delivered to the program, - -Python exceptions:: - there is the type of the exception (without the error message, which may - contain sensitive data), - -for kernel oopses:: - these are list of loaded kernel modules, list of taint flags, and full text - of the kernel oops. - -The authenticated uReports also contains *hostname* and *machineid* to enable a -server side filtering at https://access.redhat.com/. - -The authenticated uReports have the benefit of rich server replies which may -include a solution for the submitted crash. The authentication is done using -either Red Hat Subscription Certificates or Red Hat Customer Portal -credentials. - -'Warning': -The full text of a kernel oops might contain information like the -identification of the host hardware type. You should disable the autoreporting -feature if you do not want to share this information with Red Hat. - - -OPTIONS -------- --v, --verbose:: - Be more verbose. Can be given multiple times. - --a, --anonymous:: - Turns the authentication off by clearing both 'SSLClientAuth' and 'HTTPAuth' - configuration options in /etc/libreport/plugins/ureport.conf - --u, --username USERNAME:: - Turns HTTP Authentication on by setting 'HTTPAuth' configuration option to - *rhts-credentials* in /etc/libreport/plugins/ureport.conf and storing - USERNAME and PASSWORD in /etc/libreport/plugins/rhtsupport.conf - Also turns the SSL Client Authentication off, because these methods cannot - be used together. - --p, --password PASSWORD:: - Password for HTTP Authentication. If not provided, a prompt asking for it - will be issued. - --c, --certificate SOURCE:: - Turns SSL Client Authentication on by setting 'SSLClientAuth' configuration - option to SOURCE in /etc/libreport/plugins/ureport.conf. - Also turns the HTTP Authentication off, because these methods cannot - be used together. - -SEE ALSO --------- -abrt.conf(5), ureport.conf(5), rhtsupport.conf(5) - -AUTHORS -------- -* ABRT team diff --git a/src/daemon/abrt-auto-reporting.c b/src/daemon/abrt-auto-reporting.c index 573c1ae..46f8923 100644 --- a/src/daemon/abrt-auto-reporting.c +++ b/src/daemon/abrt-auto-reporting.c @@ -66,6 +66,7 @@ set_abrt_reporting(map_string_t *conf, const char *opt_value) return 1; } +#if AUTHENTICATED_AUTOREPORTING != 0 static int set_ureport_http_auth(map_string_t *conf, const char *opt_value) { @@ -136,6 +137,7 @@ set_rhts_credentials(map_string_t *conf, const char *username, const char *passw /* No changes needed -> success */ return 1; } +#endif static const char * get_abrt_reporting(map_string_t *conf) @@ -145,6 +147,7 @@ get_abrt_reporting(map_string_t *conf) return REPORTING_STATES[index][0]; } +#if AUTHENTICATED_AUTOREPORTING != 0 static const char * get_ureport_http_auth(map_string_t *conf) { @@ -156,6 +159,7 @@ get_ureport_client_auth(map_string_t *conf) { return get_map_string_item_or_NULL(conf, UREPORT_CLIENT_AUTH_OPTION); } +#endif int main(int argc, char *argv[]) { @@ -173,57 +177,78 @@ int main(int argc, char *argv[]) textdomain(PACKAGE); #endif +#define PROGRAM_USAGE_MIDDLE_PART \ + "\n" \ + "Get or modify a value of the auto-reporting option. The changes will take\n" \ + "effect immediately and will be persistent.\n" \ + "\n" \ + ""STATE_MANUAL":\n" \ + "User have to report the detect problems manually\n" \ + "\n" \ + ""STATE_AUTO":\n" \ + "ABRT uploads an uReport which was generated for a detected problem\n" \ + "immediately after the detection phase. uReport generally contains a stack\n" \ + "trace which only describes the call stack of the program at the time of the\n" \ + "crash and does not contain contents of any variables. Every uReport also\n" \ + "contains identification of the operating system, versions of the RPM packages\n" \ + "involved in the crash, and whether the program ran under a root user.\n" \ + "\n" + abrt_init(argv); +#if AUTHENTICATED_AUTOREPORTING != 0 const char *program_usage_string = _( "& [ "STATE_MANUAL" | "STATE_AUTO" | yes | no | 1 | 0 ] \\\n" " [[--anonymous] | [--username USERNAME [--password PASSWORD]] | [--certificate SOURCE]]\n" - "\n" - "Get or modify a value of the auto-reporting option. The changes will take\n" - "effect immediately and will be persistent.\n" - "\n" - ""STATE_MANUAL":\n" - "User have to report the detect problems manually\n" - "\n" - ""STATE_AUTO":\n" - "ABRT uploads an uReport which was generated for a detected problem\n" - "immediately after the detection phase. uReport generally contains a stack\n" - "trace which only describes the call stack of the program at the time of the\n" - "crash and does not contain contents of any variables. Every uReport also\n" - "contains identification of the operating system, versions of the RPM packages\n" - "involved in the crash, and whether the program ran under a root user.\n" - "\n" + PROGRAM_USAGE_MIDDLE_PART "See abrt-auto-reporting(1), reporter-ureport(1) and reporter-rhtsupport(1)\n" "for more details.\n" ); +#else + const char *program_usage_string = _( + "& [ "STATE_MANUAL" | "STATE_AUTO" | yes | no | 1 | 0 ]\n" + PROGRAM_USAGE_MIDDLE_PART + "See abrt-auto-reporting(1) and reporter-ureport(1) for more details.\n" + ); +#endif enum { OPT_v = 1 << 0, +#if AUTHENTICATED_AUTOREPORTING != 0 OPT_a = 1 << 1, OPT_u = 1 << 2, OPT_p = 1 << 3, OPT_c = 1 << 4, +#endif }; +#if AUTHENTICATED_AUTOREPORTING != 0 int anonymous = 0; const char *username = NULL; const char *password = NULL; const char *certificate = NULL; +#endif /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), +#if AUTHENTICATED_AUTOREPORTING != 0 OPT_BOOL ( 'a', "anonymous", &anonymous, _("Turns the authentication off")), OPT_STRING( 'u', "username", &username, "USERNAME", _("Red Hat Support user name")), OPT_STRING( 'p', "password", &password, "PASSWORD", _("Red Hat Support password, if not given, a prompt for it will be issued")), OPT_STRING( 'c', "certificate", &certificate, "SOURCE", _("uReport SSL certificate paths or certificate type")), +#endif OPT_END() }; - const unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); +#if AUTHENTICATED_AUTOREPORTING != 0 + const unsigned opts = +#endif + parse_opts(argc, argv, program_options, program_usage_string); argv += optind; argc -= optind; +#if AUTHENTICATED_AUTOREPORTING != 0 if ((opts & OPT_p) && !(opts & OPT_u)) { error_msg(_("You also need to specify --username for --password")); @@ -248,6 +273,7 @@ int main(int argc, char *argv[]) show_usage_and_die(program_usage_string, program_options); } +#endif if (argc > 1) { error_msg(_("Invalid number of arguments")); @@ -277,20 +303,25 @@ int main(int argc, char *argv[]) int exit_code = EXIT_FAILURE; map_string_t *conf = new_map_string(); +#if AUTHENTICATED_AUTOREPORTING != 0 map_string_t *rhts_conf = new_map_string(); map_string_t *rhts_conf_bck = NULL; +#endif map_string_t *ureport_conf = new_map_string(); map_string_t *ureport_conf_bck = NULL; if (!load_abrt_conf_file(CONF_NAME, conf)) goto finito; +#if AUTHENTICATED_AUTOREPORTING != 0 if (!load_plugin_conf_file(RHTS_NAME, rhts_conf, false)) goto finito; +#endif if (!load_plugin_conf_file(UREPORT_NAME, ureport_conf, false)) goto finito; +#if AUTHENTICATED_AUTOREPORTING != 0 if ((opts & OPT_a)) { ureport_conf_bck = clone_map_string(ureport_conf); @@ -336,11 +367,13 @@ int main(int argc, char *argv[]) goto finito; } +#endif if (argc == 0) { printf("%s", get_abrt_reporting(conf)); exit_code = EXIT_SUCCESS; +#if AUTHENTICATED_AUTOREPORTING != 0 if (g_verbose >= 1) { const char *tmp = get_ureport_http_auth(ureport_conf); @@ -352,7 +385,7 @@ int main(int argc, char *argv[]) else printf(" %s", _("anonymous auto reporting")); } - +#endif putchar('\n'); goto finito; @@ -371,16 +404,20 @@ int main(int argc, char *argv[]) if (ureport_conf_bck != NULL) save_plugin_conf_file(UREPORT_NAME, ureport_conf_bck); +#if AUTHENTICATED_AUTOREPORTING != 0 if (rhts_conf_bck != NULL) save_plugin_conf_file(RHTS_NAME, rhts_conf_bck); +#endif } finito: free_map_string(ureport_conf); free_map_string(ureport_conf_bck); +#if AUTHENTICATED_AUTOREPORTING != 0 free_map_string(rhts_conf); free_map_string(rhts_conf_bck); +#endif free_map_string(conf); return exit_code; } -- 2.4.3