|
| 1 | +const WINDOWS_SHELL = |
| 2 | + 'Run the following PowerShell script as “ADMINISTRATOR” on a server with the UTMStack agent installed.'; |
| 3 | + |
| 4 | +const LINUX_SHELL = |
| 5 | + 'Run the following Bash script as “ADMINISTRATOR” on a server with the UTMStack agent installed.'; |
| 6 | + |
1 | 7 | export interface Platform { |
2 | 8 | id: number; |
3 | 9 | name: string; |
4 | 10 | command: string; |
5 | 11 | shell: string; |
6 | | - path: string; |
7 | | - restart: string; |
| 12 | + path?: string; |
| 13 | + restart?: string; |
| 14 | + extraCommands?: string[]; |
8 | 15 | } |
9 | 16 |
|
10 | | -export const createPlatforms = (windowsCommandAMD64: string, |
11 | | - windowsCommandARM64: string, |
12 | | - linuxCommand: string, |
13 | | - windowsPath?: string, |
14 | | - windowsRestart?: string, |
15 | | - linuxPath?: string, |
16 | | - linuxRestart?: string) => [ |
17 | | - { |
18 | | - id: 1, |
19 | | - name: 'WINDOWS (AMD64)', |
20 | | - command: windowsCommandAMD64, |
21 | | - shell: 'Run the following powershell script as “ADMINISTRATOR” in a Server with the UTMStack agent Installed.', |
22 | | - path: windowsPath, |
23 | | - restart: windowsRestart |
24 | | - }, |
25 | | - { |
26 | | - id: 2, |
27 | | - name: 'WINDOWS (ARM64)', |
28 | | - command: windowsCommandARM64, |
29 | | - shell: 'Run the following powershell script as “ADMINISTRATOR” in a Server with the UTMStack agent Installed.', |
30 | | - path: windowsPath, |
31 | | - restart: windowsRestart |
32 | | - }, |
33 | | - { |
34 | | - id: 3, |
35 | | - name: 'LINUX', |
36 | | - command: linuxCommand, |
37 | | - shell: 'Run the following bash script as “ADMINISTRATOR” in a Server with the UTMStack agent Installed.', |
38 | | - path: linuxPath, |
39 | | - restart: linuxRestart |
40 | | - } |
41 | | -]; |
| 17 | +function createPlatform( |
| 18 | + id: number, |
| 19 | + name: string, |
| 20 | + command: string, |
| 21 | + shell: string, |
| 22 | + path?: string, |
| 23 | + restart?: string, |
| 24 | + extraCommands?: string[]): Platform { |
| 25 | + return { id, name, command, shell, path, restart, extraCommands }; |
| 26 | +} |
42 | 27 |
|
43 | | -export const createFileBeatsPlatforms = (windowsCommand: string, |
44 | | - linuxCommand: string, |
45 | | - windowsPath?: string, |
46 | | - windowsRestart?: string, |
47 | | - linuxPath?: string, |
48 | | - linuxRestart?: string) => [ |
49 | | - { |
50 | | - id: 1, |
51 | | - name: 'WINDOWS', |
52 | | - command: windowsCommand, |
53 | | - shell: 'Run the following powershell script as “ADMINISTRATOR” in a Server with the UTMStack agent Installed.', |
54 | | - path: windowsPath, |
55 | | - restart: windowsRestart |
56 | | - }, |
57 | | - { |
58 | | - id: 3, |
59 | | - name: 'LINUX', |
60 | | - command: linuxCommand, |
61 | | - shell: 'Run the following bash script as “ADMINISTRATOR” in a Server with the UTMStack agent Installed.', |
62 | | - path: linuxPath, |
63 | | - restart: linuxRestart |
64 | | - } |
| 28 | +export const createPlatforms = ( |
| 29 | + windowsCommandAMD64: string, |
| 30 | + windowsCommandARM64: string, |
| 31 | + linuxCommand: string, |
| 32 | + windowsPath?: string, |
| 33 | + windowsRestart?: string, |
| 34 | + linuxPath?: string, |
| 35 | + linuxRestart?: string): Platform[] => [ |
| 36 | + createPlatform( |
| 37 | + 1, |
| 38 | + 'WINDOWS (AMD64)', |
| 39 | + windowsCommandAMD64, |
| 40 | + WINDOWS_SHELL, |
| 41 | + windowsPath, |
| 42 | + windowsRestart,[ |
| 43 | + `Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\utmstack_agent_service.exe" \` |
| 44 | + -ArgumentList 'load-tls-certs', '[YOUR_CERT_PATH]', '[YOUR_KEY_PATH]' \` |
| 45 | + -NoNewWindow -Wait` |
| 46 | + ] |
| 47 | + ), |
| 48 | + createPlatform( |
| 49 | + 2, |
| 50 | + 'WINDOWS (ARM64)', |
| 51 | + windowsCommandARM64, |
| 52 | + WINDOWS_SHELL, |
| 53 | + windowsPath, |
| 54 | + windowsRestart, |
| 55 | + [ |
| 56 | + `Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\utmstack_agent_service_arm64.exe" \` |
| 57 | + -ArgumentList 'load-tls-certs', '[YOUR_CERT_PATH]', '[YOUR_KEY_PATH]' \` |
| 58 | + -NoNewWindow -Wait` |
| 59 | + ] |
| 60 | + ), |
| 61 | + createPlatform( |
| 62 | + 3, |
| 63 | + 'LINUX', |
| 64 | + linuxCommand, |
| 65 | + LINUX_SHELL, |
| 66 | + linuxPath, |
| 67 | + linuxRestart, |
| 68 | + [ |
| 69 | + `sudo bash -c "/opt/utmstack-linux-agent/utmstack_agent_service load-tls-certs [YOUR_CERT_PATH] [YOUR_KEY_PATH]"` |
| 70 | + ] |
| 71 | + ) |
65 | 72 | ]; |
66 | 73 |
|
| 74 | +export const createFileBeatsPlatforms = ( |
| 75 | + windowsCommand: string, |
| 76 | + linuxCommand: string, |
| 77 | + windowsPath?: string, |
| 78 | + windowsRestart?: string, |
| 79 | + linuxPath?: string, |
| 80 | + linuxRestart?: string): Platform[] => [ |
| 81 | + createPlatform( |
| 82 | + 1, |
| 83 | + 'WINDOWS', |
| 84 | + windowsCommand, |
| 85 | + WINDOWS_SHELL, |
| 86 | + windowsPath, |
| 87 | + windowsRestart |
| 88 | + ), |
| 89 | + createPlatform( |
| 90 | + 3, |
| 91 | + 'LINUX', |
| 92 | + linuxCommand, |
| 93 | + LINUX_SHELL, |
| 94 | + linuxPath, |
| 95 | + linuxRestart |
| 96 | + ) |
| 97 | +]; |
67 | 98 |
|
68 | 99 | export const PLATFORMS = createPlatforms( |
69 | | - 'Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\utmstack_agent_service.exe" -ArgumentList \'ACTION\',' + |
70 | | - ' \'AGENT_NAME\', \'PORT\' -NoNewWindow -Wait\n', |
71 | | - 'Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\utmstack_agent_service_arm64.exe" -ArgumentList \'ACTION\',' + |
72 | | - ' \'AGENT_NAME\', \'PORT\' -NoNewWindow -Wait\n', |
73 | | - 'sudo bash -c "/opt/utmstack-linux-agent/utmstack_agent_service ACTION AGENT_NAME PORT"' |
| 100 | + 'Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\utmstack_agent_service.exe" -ArgumentList \'ACTION\', \'AGENT_NAME\', \'PROTOCOL\' TLS -NoNewWindow -Wait\n', |
| 101 | + 'Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\utmstack_agent_service_arm64.exe" -ArgumentList \'ACTION\', \'AGENT_NAME\', \'PROTOCOL\' TLS -NoNewWindow -Wait\n', |
| 102 | + 'sudo bash -c "/opt/utmstack-linux-agent/utmstack_agent_service ACTION AGENT_NAME PROTOCOL TLS"' |
74 | 103 | ); |
75 | 104 |
|
76 | | - |
77 | 105 | export const FILEBEAT_PLATFORMS = createFileBeatsPlatforms( |
78 | | - 'cd "C:\\Program Files\\UTMStack\\UTMStack Agent\\beats\\filebeat\\"; Start-Process "filebeat.exe" -ArgumentList "modules", "enable", \"AGENT_NAME\"', |
| 106 | + 'cd "C:\\Program Files\\UTMStack\\UTMStack Agent\\beats\\filebeat\\"; Start-Process "filebeat.exe" -ArgumentList "modules", "enable", "AGENT_NAME"', |
79 | 107 | 'cd /opt/utmstack-linux-agent/beats/filebeat/ && ./filebeat modules enable AGENT_NAME', |
80 | 108 | 'C:\\Program Files\\UTMStack\\UTMStack Agent\\beats\\filebeat\\modules.d\\', |
81 | 109 | 'Stop-Service -Name UTMStackModulesLogsCollector; Start-Sleep -Seconds 5; Start-Service -Name UTMStackModulesLogsCollector', |
|
0 commit comments