/*********************************************************
- * Copyright (c) 2011-2021 VMware, Inc. All rights reserved.
+ * Copyright (c) 2011-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
const gchar *fmt,
...);
+void
+VMTools_LogThrottled(uint32 *count,
+ const gchar *fmt,
+ ...);
G_END_DECLS
#define host_warning(fmt, ...) \
/*********************************************************
- * Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
+ * Copyright (c) 2008-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
#if defined(G_PLATFORM_WIN32)
+#define VMTOOLS_CERT_MSG "Verify that a valid \"Broadcom Inc\" certificate "\
+ "is present in the Trusted Publishers certificate "\
+ "store. Refer to the VMware Tools Administration "\
+ "Guide for details."
+
gboolean
VMTools_AttachConsole(void);
GSource *
VMTools_NewHandleSource(HANDLE h);
+gboolean
+VMTools_IsGPOExecPolicyAllSigned(void);
+
+gboolean
+VMTools_IsCertPresent(void);
+
+void
+VMTools_LogWinEvent(const gchar *certMsg);
#else
/** Type of callback used by the signal event source. */
va_end(args);
}
}
+
+
+/*
+ ******************************************************************************
+ * VMTools_LogThrottled --
+ *
+ * Logs a message at 'message' log level after checking for throttling
+ * condition.
+ *
+ * @param[in/out] count Throttle count.
+ * @param[in] fmt Log message output format.
+ *
+ * XXX: In future, this function can be enhanced to log messages at different
+ * log levels.
+ *
+ * @return None
+ *
+ ******************************************************************************
+ */
+
+void
+VMTools_LogThrottled(uint32 *count,
+ const gchar *fmt,
+ ...)
+{
+ if (Util_Throttle(++*count)) {
+ va_list args;
+ gchar *msg;
+ gint length;
+
+ va_start(args, fmt);
+ length = g_vasprintf(&msg, fmt, args);
+ va_end(args);
+
+ if (length < 0) {
+ g_warning("%s g_vasprintf failed\n.", __FUNCTION__);
+ return;
+ }
+
+ g_message("%s\n", msg);
+
+ g_free(msg);
+ }
+}
/*********************************************************
- * Copyright (c) 2021,2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
*/
#include "componentMgrPlugin.h"
-
+#if defined(_WIN32)
+#include "codeset.h"
+#define VMW_TEXT_DOMAIN "vmtoolsd" // Has to be before i18h.h
+#include "vmware/tools/i18n.h"
+#include "vmware/tools/log.h"
+#endif
/*
*****************************************************************************
ComponentMgr_ResetComponentAsyncProcInfo(componentIndex);
}
+#if defined (_WIN32)
+/*
+ *****************************************************************************
+ * ComponentMgrLogWinEvent --
+ *
+ * This function logs the windows event related to certificate.
+ * The event is logged only once for the lifetime of vmtoolsd.
+ *
+ * @return
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *****************************************************************************
+ */
+
+static void
+ComponentMgrLogWinEvent()
+{
+ static gboolean cmEventLogged = FALSE;
+
+ if (cmEventLogged) {
+ return;
+ }
+
+ cmEventLogged = TRUE;
+
+ VMTools_LogWinEvent(SU_(vmtools.cert, VMTOOLS_CERT_MSG));
+}
+#endif
+
/*
*****************************************************************************
exitCode = SCRIPTFAILED;
}
#else
- if (ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode)) {
+ int ret;
+
+ ret = ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode);
+ if (ret != 0) {
exitCode = SCRIPTFAILED;
}
+
+ if ((ret != 0 ||
+ exitCode == 1) &&
+ VMTools_IsGPOExecPolicyAllSigned() &&
+ !VMTools_IsCertPresent()) {
+ static uint32 logCount = 0;
+ /*
+ * Exit code 1 is a special case. We assume this is because the
+ * componentMgr process/script failed to launch. Check if there
+ * is a certificate issue and log appropriately.
+ *
+ * If the componentMgr process/script ran and it didn't result in
+ * a desired state, those exit codes will be different.
+ */
+ VMTools_LogThrottled(&logCount, "%s", VMTOOLS_CERT_MSG);
+ ComponentMgrLogWinEvent();
+ }
#endif
g_debug("%s: Checking status of a component has terminated gracefully"
" with exit code %d.\n", __FUNCTION__, exitCode);
* Free all the async process resources and destroy the GSource timer.
*/
g_debug("%s: Async process has exited.\n", __FUNCTION__);
+#if defined(_WIN32)
+ int exitCode;
+ int ret;
+
+ ret = ProcMgr_GetExitCode(procInfo->asyncProc, &exitCode);
+ if ((ret != 0 ||
+ exitCode == 1) &&
+ VMTools_IsGPOExecPolicyAllSigned() &&
+ !VMTools_IsCertPresent()) {
+ static uint32 logCount = 0;
+ /*
+ * Exit code 1 is a special case. We assume this is because the
+ * componentMgr process/script failed to launch. Check if there
+ * is a certificate issue and log appropriately.
+ *
+ * If the componentMgr process/script ran and it didn't result in
+ * a desired state, those exit codes will be different.
+ */
+ VMTools_LogThrottled(&logCount, "%s", VMTOOLS_CERT_MSG);
+ ComponentMgrLogWinEvent();
+ }
+#endif
ComponentMgr_FreeAsyncProc(procInfo);
ComponentMgr_ResetComponentGSourceTimer(componentIndex);
##########################################################
-# Copyright (C) 2010, 2020-2021 VMware, Inc. All rights reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
+# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
cmdline.version = "Prints the daemon version and exits."
+vmtools.cert = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."
##########################################################
-# Copyright (c) 2010-2024 Broadcom. All Rights Reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
#
# This program is free software; you can redistribute it and/or modify it
cmdline.version = "Imprime la versión daemon y sale."
+vmtools.cert = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."
##########################################################
-# Copyright (c) 2010-2024 Broadcom. All Rights Reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
#
# This program is free software; you can redistribute it and/or modify it
cmdline.uinputfd.fd = "fd"
cmdline.uninstall = "Désinstalle le service du Gestionnaire de contrôle du service."
-
+s
cmdline.version = "Imprime la version démon et quitte l'application."
+vmtools.cert = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."
##########################################################
-# Copyright (c) 2010-2024 Broadcom. All Rights Reserved.
+# Copyright (c) 2010-2025 Broadcom. All Rights Reserved.
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
#
# This program is free software; you can redistribute it and/or modify it
cmdline.version = "デーモンのバージョンを出力し、終了します。"
+vmtools.cert = "Verify that a valid \"Broadcom Inc\" certificate is present in the Trusted Publishers certificate store. Refer to the VMware Tools Administration Guide for details."