Browse Source

Windows Permissions (#18443)

* wins_perm: Modify original netdata_claim manifest adding external version

* wins_perm: Add resources to netdatacli

* wins_perm: Add resources to netdata

* win_rename: Restore lines removed. They will be removed in another PR.

* win_perm: Update manifest
thiagoftsm 6 months ago
parent
commit
6075275dc4

+ 1 - 0
.gitignore

@@ -179,6 +179,7 @@ Session.*.vim
 
 # Special exceptions
 !packaging/repoconfig/Makefile
+packaging/windows/resources/*.manifest
 
 # Jupyter notebook checkpoints
 .ipynb_checkpoints

+ 13 - 3
CMakeLists.txt

@@ -2241,17 +2241,27 @@ endif()
 # build netdata (only Linux ATM)
 #
 
+if(OS_WINDOWS)
+        set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc")
+        configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY)
+
+        set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc")
+        configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY)
+
+        set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc")
+        configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY)
+endif()
+
 add_executable(netdata
         ${NETDATA_FILES}
         "${ACLK_FILES}"
         "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>"
         "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>"
         "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>"
+        "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>"
 )
 
 if(OS_WINDOWS)
-        set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc")
-
         add_executable(netdata_claim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
         target_link_libraries(netdata_claim shell32;gdi32;msftedit)
 endif()
@@ -2353,7 +2363,7 @@ set(NETDATACLI_FILES
         src/cli/cli.c
 )
 
-add_executable(netdatacli ${NETDATACLI_FILES})
+add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>")
 target_link_libraries(netdatacli libnetdata)
 
 install(TARGETS netdatacli

+ 16 - 0
packaging/windows/resources/netdata.manifest.in

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+	<assemblyIdentity version="@CMAKE_PROJECT_VERSION@"
+     processorArchitecture="*"
+     name="netdata"
+     type="win32"/>
+	<description>Netdata is a high-performance, cloud-native, and on-premises observability platform designed to monitor metrics and logs with unparalleled efficiency.</description>
+	<!-- Identify the application security requirements. -->
+	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+		<security>
+			<requestedPrivileges>
+				<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
+			</requestedPrivileges>
+		</security>
+	</trustInfo>
+</assembly>

+ 3 - 0
packaging/windows/resources/netdata.rc

@@ -0,0 +1,3 @@
+#include "winuser.h"
+1 RT_MANIFEST "netdata.manifest"
+11 ICON "../NetdataWhite.ico"

+ 1 - 1
packaging/windows/resources/netdata_claim.manifest → packaging/windows/resources/netdata_claim.manifest.in

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-	<assemblyIdentity version="1.99.0.0"
+	<assemblyIdentity version="@CMAKE_PROJECT_VERSION@"
      processorArchitecture="*"
      name="netdata_claim"
      type="win32"/>

+ 16 - 0
packaging/windows/resources/netdatacli.manifest.in

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+	<assemblyIdentity version="@CMAKE_PROJECT_VERSION@"
+     processorArchitecture="*"
+     name="netdatacli"
+     type="win32"/>
+	<description>The netdatacli executable provides a simple way to control the Netdata agent's operation.</description>
+	<!-- Identify the application security requirements. -->
+	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+		<security>
+			<requestedPrivileges>
+				<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
+			</requestedPrivileges>
+		</security>
+	</trustInfo>
+</assembly>

+ 3 - 0
packaging/windows/resources/netdatacli.rc

@@ -0,0 +1,3 @@
+#include "winuser.h"
+1 RT_MANIFEST "netdatacli.manifest"
+11 ICON "../NetdataWhite.ico"