]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Wed, 10 Dec 2025 05:31:19 +0000 (21:31 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 10 Dec 2025 05:31:19 +0000 (21:31 -0800)
open-vm-tools/lib/include/vmware/tools/utils.h
open-vm-tools/libvmtools/vmtoolsMisc.c
open-vm-tools/services/plugins/componentMgr/componentMgrInstallAction.c
open-vm-tools/services/plugins/componentMgr/componentMgrInstallManager.c
open-vm-tools/services/vmtoolsd/l10n/en.vmsg
open-vm-tools/services/vmtoolsd/l10n/es.vmsg
open-vm-tools/services/vmtoolsd/l10n/fr.vmsg
open-vm-tools/services/vmtoolsd/l10n/ja.vmsg

index 8fec8af3f3120149796a47eb2c3016ca73ad0f75..a6042c45e4fde9cf675368b66e3850ee1ccfb1ce 100644 (file)
@@ -145,11 +145,14 @@ VMTools_ConfigGetString(GKeyFile *config,
 
 #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."
-
+#define VMTOOLS_WIN_EVENT_SOURCE_NAME  L"VMware Tools"
+
+#define VMTOOLS_CERT_MSG "Verify that a valid VMware Tools signing "\
+                         "certificate is present in the Trusted "\
+                         "Publishers certificate store on the system. "\
+                         "Refer to the VMware Tools Administration Guide "\
+                         "for how to set up a VMware Tools signing "\
+                         "certificate."
 gboolean
 VMTools_AttachConsole(void);
 
@@ -157,10 +160,10 @@ GSource *
 VMTools_NewHandleSource(HANDLE h);
 
 gboolean
-VMTools_IsGPOExecPolicyAllSigned(void);
+VMTools_IsPSScriptSigningEnforced(void);
 
 gboolean
-VMTools_IsCertPresent(void);
+VMTools_IsScriptSignerCertPresent(void);
 
 void
 VMTools_LogWinEvent(const gchar *certMsg);
index a9d6020baaa0bff4df94d43a46b748acd5c703fa..46eb4f8a961837323b098024db10db087f0a5f8c 100644 (file)
@@ -123,17 +123,20 @@ exit:
 #define POWERSHELL_GPO_REG_KEY \
         "Software\\Policies\\Microsoft\\Windows\\PowerShell"
 #define POWERSHELL_GPO_EXEC_POLICY "ExecutionPolicy"
+#define VMTOOLS_SIGNER L"Broadcom Inc"
+#define POWERSHELL_EXEC_POLICY_ALLSIGNED "AllSigned"
 #define VMW_CERT_ENCODING (X509_ASN_ENCODING | PKCS_7_ASN_ENCODING)
 
 
 /*
  ******************************************************************************
- * VMTools_IsGPOExecPolicyAllSigned --
+ * VMTools_IsPSScriptSigningEnforced --
  *
- * Check the powershell GPO machine execution policy
+ * Check the GPO PowerShell Execution Policy
  *
- * @return TRUE if powershell GPO MachinePolicy is set to AllSigned.
- *         FALSE in case of error or if MachinePolicy is not AllSigned.
+ * @return TRUE if GPO PowerShell Execution Policy is set to AllSigned.
+ *         FALSE in case of error or if GPO PowerShell Execution Policy
+ *         not AllSigned.
  *
  * Side effects:
  *      None.
@@ -142,7 +145,7 @@ exit:
  */
 
 gboolean
-VMTools_IsGPOExecPolicyAllSigned(void)
+VMTools_IsPSScriptSigningEnforced(void)
 {
    LONG ret;
    HKEY hKey;
@@ -157,7 +160,13 @@ VMTools_IsGPOExecPolicyAllSigned(void)
                        KEY_READ,
                        &hKey);
    if (ret != ERROR_SUCCESS) {
-      g_debug("%s: Registry open failed.\n", __FUNCTION__);
+      if (ret == ERROR_FILE_NOT_FOUND) {
+         g_debug("%s: The key for GPO PowerShell ExecutionPolicy does not "
+                 "exist.\n", __FUNCTION__);
+      } else {
+         g_warning("%s: Failed to open registry for GPO PowerShell "
+                   "ExecutionPolicy. ret: %d\n", __FUNCTION__, ret);
+      }
       return FALSE;
    }
 
@@ -170,23 +179,34 @@ VMTools_IsGPOExecPolicyAllSigned(void)
 
    RegCloseKey(hKey);
 
-   if (ret != ERROR_SUCCESS || regSz != REG_SZ || len == 0) {
-      g_debug("%s: Failed to get powershell GPO policy. ret: %d\n",
-              __FUNCTION__,
-              ret);
+   if (ret != ERROR_SUCCESS) {
+      if (ret == ERROR_FILE_NOT_FOUND) {
+         g_debug("%s: The value for GPO PowerShell ExecutionPolicy "
+                 "is not found.\n", __FUNCTION__);
+      } else {
+         g_warning("%s: Failed to get GPO PowerShell ExecutionPolicy. "
+                   "ret: %d\n", __FUNCTION__, ret);
+      }
+      return FALSE;
+   }
+
+   if (regSz != REG_SZ) {
+      g_warning("%s: The value of GPO PowerShell ExecutionPolicy is not of "
+                "type string.\n", __FUNCTION__);
       return FALSE;
    }
 
    buf[len] = '\0';
-   g_debug("%s: Powershell GPO execution policy: \"%s\"\n", __FUNCTION__, buf);
 
-   return (g_strcmp0(buf, "AllSigned") == 0);
+   g_debug("%s: GPO PowerShell ExecutionPolicy: \"%s\"\n", __FUNCTION__, buf);
+
+   return (g_strcmp0(buf, POWERSHELL_EXEC_POLICY_ALLSIGNED) == 0);
 }
 
 
 /*
  ******************************************************************************
- * VMTools_IsCertPresent --
+ * VMTools_IsScriptSignerCertPresent --
  *
  * Checks if our certificate is present in TrustedPublisher cert store.
  *
@@ -197,15 +217,18 @@ VMTools_IsGPOExecPolicyAllSigned(void)
  * Side effects:
  *      None.
  *
+ * XXX: In future, this needs to be enhanced to check for the certificate that
+ *      is used to sign the PowerShell scripts or any of the binaries.
+ *
  ******************************************************************************
  */
 
 gboolean
-VMTools_IsCertPresent()
+VMTools_IsScriptSignerCertPresent()
 {
    HCERTSTORE trustedPublisher;
    static const wchar_t *certStoreW = L"TrustedPublisher";
-   static const wchar_t *certSubjectW = L"Broadcom Inc";
+   static const wchar_t *certSubjectW = VMTOOLS_SIGNER;
    PCCERT_CONTEXT certContext;
 
    trustedPublisher = CertOpenStore(CERT_STORE_PROV_SYSTEM_W,
@@ -264,9 +287,11 @@ VMTools_LogWinEvent(const gchar *msg)
    HANDLE h;
    wchar_t *msgBufW;
 
-   h = RegisterEventSourceW(NULL, L"VMware Tools");
+   h = RegisterEventSourceW(NULL, VMTOOLS_WIN_EVENT_SOURCE_NAME);
    if (h == NULL) {
-      g_debug("%s: Register windows event failed.\n", __FUNCTION__);
+      g_warning("%s: Failed to register event source. err: %d\n",
+                __FUNCTION__,
+                GetLastError());
       return;
    }
 
index 6589fed0016498907fa286e5edf0b4848f93e5c7..1ecc7eb52cb351394f5336024479a6469aa5a4f8 100644 (file)
@@ -116,7 +116,7 @@ static struct ComponentInfo components[] = {
  */
 #if defined(_WIN32)
 static const char powershellExecutable[] = "\\WindowsPowerShell\\v1.0\\PowerShell.exe";
-static const char powershellOption[] = "-ExecutionPolicy RemoteSigned -File";
+static const char powershellOption[] = "-NonInteractive -ExecutionPolicy RemoteSigned -File";
 
 static ComponentAction executionScripts[] = {
    {SALT_MINION,"svtminion.ps1", "-Install", "-Remove", "-Status", "-Loglevel debug", "saltMinion", NULL, &ComponentMgrCustomizeSaltAddAction}
@@ -416,7 +416,7 @@ ComponentMgrCustomizeSaltAddAction()
  * component.
  *
  * The windows counterpart is constructed as:
- * <path to powershell.exe> -ExecutionPolicy RemoteSigned -File \
+ * <path to PowerShell.exe> -ExecutionPolicy RemoteSigned -File \
  * <path to component script> <args to component script>
  *
  * The linux counterpart is constructed as:
index 1f185c91f5e3b09b9638aa8fbcefa65d12a09283..0cae7fbfe25815dfb500be2a8499e7f324d31a3b 100644 (file)
@@ -173,8 +173,8 @@ ComponentMgrCheckStatusMonitor(void *data) // IN
 
       if ((ret != 0 ||
            exitCode == 1) &&
-          VMTools_IsGPOExecPolicyAllSigned() &&
-          !VMTools_IsCertPresent()) {
+          VMTools_IsPSScriptSigningEnforced() &&
+          !VMTools_IsScriptSignerCertPresent()) {
          static uint32 logCount = 0;
          /*
           * Exit code 1 is a special case. We assume this is because the
@@ -306,8 +306,8 @@ ComponentMgrProcessMonitor(void *data) // IN
 
       if ((ret != 0 ||
            exitCode == 1) &&
-          VMTools_IsGPOExecPolicyAllSigned() &&
-          !VMTools_IsCertPresent()) {
+          VMTools_IsPSScriptSigningEnforced() &&
+          !VMTools_IsScriptSignerCertPresent()) {
          static uint32 logCount = 0;
          /*
           * Exit code 1 is a special case. We assume this is because the
index df38595923e485f36ec29a6a5906f3c72f5c996a..ddb51d932077552e7f649643537dd134d8705a08 100644 (file)
@@ -76,4 +76,4 @@ cmdline.uninstall = "Uninstalls the service from the Service Control Manager."
 
 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."
+vmtools.cert = "Verify that a valid VMware Tools signing certificate is present in the Trusted Publishers certificate store on the system. Refer to the VMware Tools Administration Guide for how to set up a VMware Tools signing certificate."
index 34ea58d80d786754f78724332b011c2ec281ab6e..86fa3926195a76b56f0bc5dd4e02cbd00639dc25 100644 (file)
@@ -76,4 +76,4 @@ cmdline.uninstall = "Desinstala el servicio desde el Administrador de control de
 
 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."
+vmtools.cert = "Verify that a valid VMware Tools signing certificate is present in the Trusted Publishers certificate store on the system. Refer to the VMware Tools Administration Guide for how to set up a VMware Tools signing certificate."
index cba3166ef1ef4f16c316c85f87fdd1c1730eca97..c98a945c5639ef33e0a2edc53ed131d462be155c 100644 (file)
@@ -73,7 +73,7 @@ cmdline.uinputfd = "Descripteur de fichier pour le périphérique uinput."
 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."
+vmtools.cert = "Verify that a valid VMware Tools signing certificate is present in the Trusted Publishers certificate store on the system. Refer to the VMware Tools Administration Guide for how to set up a VMware Tools signing certificate."
index 295a08110596004f0ef62ef0d7a4948526e16a1f..07473acb49d2c25d52034565484476391af1a1d4 100644 (file)
@@ -76,4 +76,4 @@ cmdline.uninstall = "Service Control Manager からサービスをアンイン
 
 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."
+vmtools.cert = "Verify that a valid VMware Tools signing certificate is present in the Trusted Publishers certificate store on the system. Refer to the VMware Tools Administration Guide for how to set up a VMware Tools signing certificate."