diff --git a/0004-tools-install-script-Add-config-file-f-option.patch b/0004-tools-install-script-Add-config-file-f-option.patch new file mode 100644 index 0000000..be355aa --- /dev/null +++ b/0004-tools-install-script-Add-config-file-f-option.patch @@ -0,0 +1,170 @@ +From 08fb8316b4ac42fe74c1fa5ca0ac593222cdf81a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= +Date: Wed, 3 Jul 2019 14:55:24 +0200 +Subject: [PATCH] tools,install-script: Add --config-file (-f) option +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Let's add a new option so users can set their config from a file, +instead of directly passing the values via command-line. + +CVE-2019-13313 +Libosinfo: osinfo-install-script option leaks password via command line +argument. 'osinfo-install-script' is used to generate a script for +automated guest installations. It accepts user and admin passwords via +command line arguments, thus leaking them via process listing. + +Signed-off-by: Fabiano Fidêncio +Reviewed-by: Daniel P. Berrangé +--- + tools/osinfo-install-script.c | 103 +++++++++++++++++++++++++++++++++- + 1 file changed, 102 insertions(+), 1 deletion(-) + +diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c +index 15af48d..af58440 100644 +--- a/tools/osinfo-install-script.c ++++ b/tools/osinfo-install-script.c +@@ -37,6 +37,34 @@ static gboolean list_profile = FALSE; + static gboolean list_inj_method = FALSE; + static gboolean quiet = FALSE; + ++static const gchar *configs[] = { ++ OSINFO_INSTALL_CONFIG_PROP_HARDWARE_ARCH, ++ OSINFO_INSTALL_CONFIG_PROP_L10N_TIMEZONE, ++ OSINFO_INSTALL_CONFIG_PROP_L10N_LANGUAGE, ++ OSINFO_INSTALL_CONFIG_PROP_L10N_KEYBOARD, ++ OSINFO_INSTALL_CONFIG_PROP_ADMIN_PASSWORD, ++ OSINFO_INSTALL_CONFIG_PROP_USER_PASSWORD, ++ OSINFO_INSTALL_CONFIG_PROP_USER_LOGIN, ++ OSINFO_INSTALL_CONFIG_PROP_USER_REALNAME, ++ OSINFO_INSTALL_CONFIG_PROP_USER_AUTOLOGIN, ++ OSINFO_INSTALL_CONFIG_PROP_USER_ADMIN, ++ OSINFO_INSTALL_CONFIG_PROP_REG_LOGIN, ++ OSINFO_INSTALL_CONFIG_PROP_REG_PASSWORD, ++ OSINFO_INSTALL_CONFIG_PROP_REG_PRODUCTKEY, ++ OSINFO_INSTALL_CONFIG_PROP_HOSTNAME, ++ OSINFO_INSTALL_CONFIG_PROP_TARGET_DISK, ++ OSINFO_INSTALL_CONFIG_PROP_SCRIPT_DISK, ++ OSINFO_INSTALL_CONFIG_PROP_AVATAR_LOCATION, ++ OSINFO_INSTALL_CONFIG_PROP_AVATAR_DISK, ++ OSINFO_INSTALL_CONFIG_PROP_PRE_INSTALL_DRIVERS_DISK, ++ OSINFO_INSTALL_CONFIG_PROP_PRE_INSTALL_DRIVERS_LOCATION, ++ OSINFO_INSTALL_CONFIG_PROP_POST_INSTALL_DRIVERS_DISK, ++ OSINFO_INSTALL_CONFIG_PROP_POST_INSTALL_DRIVERS_LOCATION, ++ OSINFO_INSTALL_CONFIG_PROP_DRIVER_SIGNING, ++ OSINFO_INSTALL_CONFIG_PROP_INSTALLATION_URL, ++ NULL ++}; ++ + static OsinfoInstallConfig *config; + + static gboolean handle_config(const gchar *option_name G_GNUC_UNUSED, +@@ -65,6 +93,47 @@ static gboolean handle_config(const gchar *option_name G_GNUC_UNUSED, + } + + ++static gboolean handle_config_file(const gchar *option_name G_GNUC_UNUSED, ++ const gchar *value, ++ gpointer data G_GNUC_UNUSED, ++ GError **error) ++{ ++ GKeyFile *key_file = NULL; ++ gchar *val = NULL; ++ gsize i; ++ gboolean ret = FALSE; ++ ++ key_file = g_key_file_new(); ++ if (!g_key_file_load_from_file(key_file, value, G_KEY_FILE_NONE, error)) ++ goto error; ++ ++ for (i = 0; configs[i] != NULL; i++) { ++ val = g_key_file_get_string(key_file, "install-script", configs[i], error); ++ if (val == NULL) { ++ if (g_error_matches(*error, G_KEY_FILE_ERROR, ++ G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { ++ g_clear_error(error); ++ continue; ++ } ++ ++ goto error; ++ } ++ ++ osinfo_entity_set_param(OSINFO_ENTITY(config), ++ configs[i], ++ val); ++ g_free(val); ++ } ++ ++ ret = TRUE; ++ ++error: ++ g_key_file_unref(key_file); ++ ++ return ret; ++} ++ ++ + static GOptionEntry entries[] = + { + { "profile", 'p', 0, G_OPTION_ARG_STRING, (void*)&profile, +@@ -78,6 +147,9 @@ static GOptionEntry entries[] = + { "config", 'c', 0, G_OPTION_ARG_CALLBACK, + handle_config, + N_("Set configuration parameter"), "key=value" }, ++ { "config-file", 'f', 0, G_OPTION_ARG_CALLBACK, ++ handle_config_file, ++ N_("Set configuration parameters"), "file:///path/to/config/file" }, + { "list-config", '\0', 0, G_OPTION_ARG_NONE, (void*)&list_config, + N_("List configuration parameters"), NULL }, + { "list-profiles", '\0', 0, G_OPTION_ARG_NONE, (void*)&list_profile, +@@ -448,6 +520,15 @@ script. Defaults to C, but can also be C. + + Set the configuration parameter C to C. + ++=item B<--config-file=config-file> ++ ++Set the configurations parameters according to the config-file passed. ++ ++Note that use of --config-file is strongly recommended if the user or ++admin passwords need to be set. Providing passwords directly using ++B<--config=> is insecure as the password is visible to all processes ++and users on the same host. ++ + =back + + =head1 CONFIGURATION KEYS +@@ -510,9 +591,29 @@ The software registration user password + + =back + ++=head1 CONFIGURATION FILE FORMAT ++ ++The configuration file must consist in a file which contains a ++`install-script` group and, under this group, C=C ++pairs, as shown below: ++ ++[install-script] ++l10n-timezone=GMT ++l10n-keyboard=uk ++l10n-language=en_GB ++admin-password=123456 ++user-login=berrange ++user-password=123456 ++user-realname="Daniel P Berrange" ++ + =head1 EXAMPLE USAGE + +-The following usage generates a Fedora 16 kickstart script ++The following usages generates a Fedora 16 kickstart script ++ ++ # osinfo-install-script \ ++ --profile jeos \ ++ --config-file /path/to/config/file \ ++ fedora16 + + # osinfo-install-script \ + --profile jeos \ +-- +2.21.0 + diff --git a/0005-tools-install-script-Deprecate-config-user-admin-pas.patch b/0005-tools-install-script-Deprecate-config-user-admin-pas.patch new file mode 100644 index 0000000..3889bfd --- /dev/null +++ b/0005-tools-install-script-Deprecate-config-user-admin-pas.patch @@ -0,0 +1,59 @@ +From 3654abee6ead9f11f8bb9ba8fc71efd6fa4dabbc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= +Date: Wed, 3 Jul 2019 14:59:07 +0200 +Subject: [PATCH] tools,install-script: Deprecate --config + {user,admin}-password +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Let's deprecate user-password and admin-password options of --config and +also warn out whenever they're passed to osinfo-install-script. + +CVE-2019-13313 +Libosinfo: osinfo-install-script option leaks password via command line +argument. 'osinfo-install-script' is used to generate a script for +automated guest installations. It accepts user and admin passwords via +command line arguments, thus leaking them via process listing. + +Signed-off-by: Fabiano Fidêncio +Reviewed-by: Daniel P. Berrangé +--- + tools/osinfo-install-script.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c +index af58440..c0528e7 100644 +--- a/tools/osinfo-install-script.c ++++ b/tools/osinfo-install-script.c +@@ -85,6 +85,12 @@ static gboolean handle_config(const gchar *option_name G_GNUC_UNUSED, + val++; + key = g_strndup(value, len); + ++ if (g_str_equal(key, OSINFO_INSTALL_CONFIG_PROP_USER_PASSWORD) || ++ g_str_equal(key, OSINFO_INSTALL_CONFIG_PROP_ADMIN_PASSWORD)) { ++ g_warning("When setting user or admin password, use --config-file " ++ "instead.\n"); ++ } ++ + osinfo_entity_set_param(OSINFO_ENTITY(config), + key, + val); +@@ -556,10 +562,14 @@ The local language + =item C + + The administrator password ++This option has been deprecated, use B<--config-file> ++for setting the admin password. + + =item C + + The user password ++This option has been deprecated, use B<--config-file> ++for setting the user password. + + =item C + +-- +2.21.0 + diff --git a/libosinfo.spec b/libosinfo.spec index ac4055d..11f3e94 100644 --- a/libosinfo.spec +++ b/libosinfo.spec @@ -3,7 +3,7 @@ Summary: A library for managing OS information for virtualization Name: libosinfo Version: 1.5.0 -Release: 2%{?dist}%{?extra_release} +Release: 3%{?dist}%{?extra_release} License: LGPLv2+ Source: https://releases.pagure.io/%{name}/%{name}-%{version}.tar.gz URL: https://libosinfo.org/ @@ -12,6 +12,8 @@ URL: https://libosinfo.org/ Patch0001: 0001-db-Avoid-dereference-of-null-pointer.patch Patch0002: 0002-tree-Avoid-use-of-memory-after-it-s-freed.patch Patch0003: 0003-tree-Cleanup-_create_from_location_async_helper.patch +Patch0004: 0004-tools-install-script-Add-config-file-f-option.patch +Patch0005: 0005-tools-install-script-Deprecate-config-user-admin-pas.patch BuildRequires: gettext-devel BuildRequires: glib2-devel @@ -102,6 +104,10 @@ fi %{_datadir}/vala/vapi/libosinfo-1.0.vapi %changelog +* Wed Jul 10 2019 Fabiano Fidêncio - 1.5.0-3 +- rhbz#1727767 - CVE-2019-13313 libosinfo: osinfo-install-script + option leaks password via command line argument + * Mon Jun 03 2019 Fabiano Fidêncio - 1.5.0-2 - Fix coverity issues