diff --git a/SplunkAppForWazuh/appserver/static/js/config/routes/management-states.js b/SplunkAppForWazuh/appserver/static/js/config/routes/management-states.js index 891411e16..1cb43bf9c 100644 --- a/SplunkAppForWazuh/appserver/static/js/config/routes/management-states.js +++ b/SplunkAppForWazuh/appserver/static/js/config/routes/management-states.js @@ -290,6 +290,16 @@ define(['../module'], function(module) { } } ], + agentsInfo: [ + '$requestService', + '$state', + async $requestService => { + try { + const result = await $requestService.apiReq('/agents/summary') + return result + } catch (err) {} //eslint-disable-line + } + ], isAdmin: [ '$currentDataService', async $currentDataService => { diff --git a/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groups.html b/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groups.html index 1461391e9..e764aca92 100644 --- a/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groups.html +++ b/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groups.html @@ -1,4 +1,16 @@ -
+ +
+
+ Deploy a new agent +  close +
+ +
+ + + +
@@ -13,6 +25,17 @@
+ +
+
+
+ + There are no agents registered to this manager. Deploy a new agent +
+
+
+ +
@@ -229,6 +252,4 @@
-
-
\ No newline at end of file diff --git a/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groupsCtrl.js b/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groupsCtrl.js index 82afde774..4cc56d4d5 100644 --- a/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groupsCtrl.js +++ b/SplunkAppForWazuh/appserver/static/js/controllers/management/groups/groupsCtrl.js @@ -27,6 +27,7 @@ define(['../../module', 'FileSaver'], function(controllers) { $reportingService, $groupHandler, extensions, + agentsInfo, isAdmin ) { this.scope = $scope @@ -49,7 +50,10 @@ define(['../../module', 'FileSaver'], function(controllers) { groupConf: true, agentsList: true } + this.scope.showRegisterGuide = false + this.scope.agentsCountTotal = agentsInfo.data.data.Total - 1 this.scope.showModulesToExport = () => this.showModulesToExport() + this.scope.showRegisterAgent = () => this.showRegisterAgent() this.scope.keyEquivalences = key => this.keyEquivalences(key) this.scope.selectAll = value => this.selectAll(value) this.scope.checkAllDisabled = () => this.checkAllDisabled() @@ -613,6 +617,17 @@ define(['../../module', 'FileSaver'], function(controllers) { this.scope.$applyAsync() return } + + /** + * Shows/hide the register agent guide + */ + showRegisterAgent() { + try { + this.scope.showRegisterGuide = !this.scope.showRegisterGuide + } catch (error) { + console.error('Error showing the register agent guide ', error) + } + } /* * Get the key equivalences diff --git a/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overview-welcome.html b/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overview-welcome.html index c0a0b6582..b907ca871 100644 --- a/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overview-welcome.html +++ b/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overview-welcome.html @@ -1,6 +1,31 @@ -
+ + + +
+
+ Deploy a new agent +  close +
+ +
+ + +
+
+ +
+
+
+ + There are no agents registered to this manager. Deploy a new agent +
+
+
+ +
@@ -42,200 +67,202 @@
+ + +
+
+
+
+

Security Information Management

+
+ Show extensions list + +
+
+
    +
  • + + Amazon AWS +
  • +
+
+
+
+ + + + + + +
+
+
+ +
+
+

Auditing and Policy Monitoring

+
+ Show extensions list + +
+
+
    +
  • + + System auditing +
  • +
  • + + OpenSCAP +
  • +
  • + + CIS-CAT +
  • +
+
+
+
+ + + + +
+
+
+
+
+
-

Security Information Management

+

Threat Detection and Response

Show extensions list - + +
-
+
  • - - Amazon AWS + + VirusTotal +
  • +
  • + Osquery +
  • +
  • + + Docker listener
- + - + - + + + +
+
+ + Click the icon to show threat detection and response extensions. +
+
-

Auditing and Policy Monitoring

+

Regulatory Compliance

Show extensions list - +
-
+
    -
  • - - System auditing -
  • -
  • - - OpenSCAP -
  • -
  • - - CIS-CAT -
  • +
  • + + PCI DSS +
  • +
  • + + GDPR +
  • +
  • + + HIPAA +
  • +
  • + + NIST 800-53 +
- - - - -
-
-
-
-
-
- -
-
-
-
-

Threat Detection and Response

-
- Show extensions list - - -
-
-
    -
  • - - VirusTotal -
  • -
  • - Osquery -
  • -
  • - - Docker listener -
  • -
-
-
-
- - - - - - - - -
-
- - Click the icon to show threat detection and response extensions. -
-
-
-
-
- -
-
-

Regulatory Compliance

-
- Show extensions list - -
-
-
    -
  • - - PCI DSS -
  • -
  • - - GDPR -
  • -
  • - - HIPAA -
  • -
  • - - NIST 800-53 -
  • -
-
-
-
- - - - - - - - -
-
- - Click the icon to show threat detection and response extensions. + + + + + + + + +
+
+ + Click the icon to show threat detection and response extensions. +
diff --git a/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overviewWelcomeCtrl.js b/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overviewWelcomeCtrl.js index 266c20654..26c4aea73 100644 --- a/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overviewWelcomeCtrl.js +++ b/SplunkAppForWazuh/appserver/static/js/controllers/overview/welcome/overviewWelcomeCtrl.js @@ -25,6 +25,7 @@ define(['../../module'], function(controllers) { threadDetection: false, regulatory: false } + this.scope.showRegisterGuide = false try { this.scope.agentsCountTotal = agentsInfo.data.data.Total - 1 this.scope.agentsCountActive = agentsInfo.data.data.Active - 1 @@ -45,6 +46,7 @@ define(['../../module'], function(controllers) { $onInit() { this.refreshExtensions() this.scope.showExtensionsLists = card => this.showExtensionsLists(card) + this.scope.showRegisterAgent = () => this.showRegisterAgent() this.scope.toggleExtension = (extension, state) => this.toggleExtension(extension, state) this.scope.$applyAsync() @@ -63,6 +65,17 @@ define(['../../module'], function(controllers) { } } + /** + * Shows/hide the register agent guide + */ + showRegisterAgent() { + try { + this.scope.showRegisterGuide = !this.scope.showRegisterGuide + } catch (error) { + console.error('Error showing the register agent guide ', error) + } + } + /** * Enable or disable extension * @param {String} extension diff --git a/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.html b/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.html index 7d79b7828..feb982cc0 100644 --- a/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.html +++ b/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.html @@ -1,8 +1,11 @@
- +
+
+
+ -
+
1
Choose your OS
@@ -36,10 +39,21 @@ ng-change="selectManagerAddress(managerAddress)">
+ + +
+
3
+
+
Wazuh password
+
+ +
+
-
3
+
{{passwordNeeded ? 4 : 3}}
Complete the installation
@@ -64,7 +78,12 @@ Copy to clipboard - sudo WAZUH_MANAGER_IP='{{config.managerIp}}' yum install https://packages.wazuh.com/3.x/yum/wazuh-agent-{{wazuhVersion}}-1.x86_64.rpm + + sudo WAZUH_MANAGER_IP='{{config.managerIp}}' WAZUH_PASSWORD='{{config.wazuhPassword}}' yum install https://packages.wazuh.com/3.x/yum/wazuh-agent-{{wazuhVersion}}-1.x86_64.rpm + + + sudo WAZUH_MANAGER_IP='{{config.managerIp}}' yum install https://packages.wazuh.com/3.x/yum/wazuh-agent-{{wazuhVersion}}-1.x86_64.rpm +
@@ -76,7 +95,12 @@ Copy to clipboard - curl -so wazuh-agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_{{wazuhVersion}}-1_amd64.deb && sudo WAZUH_MANAGER_IP='{{config.managerIp}}' dpkg -i ./wazuh-agent.deb + + curl -so wazuh-agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_{{wazuhVersion}}-1_amd64.deb && sudo WAZUH_MANAGER_IP='{{config.managerIp}}' WAZUH_PASSWORD='{{config.wazuhPassword}}' dpkg -i ./wazuh-agent.deb + + + curl -so wazuh-agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_{{wazuhVersion}}-1_amd64.deb && sudo WAZUH_MANAGER_IP='{{config.managerIp}}' dpkg -i ./wazuh-agent.deb +
@@ -88,7 +112,12 @@ Copy to clipboard - Invoke-WebRequest -Uri https://packages.wazuh.com/3.x/windows/wazuh-agent-{{wazuhVersion}}-1.msi -OutFile wazuh-agent.msi; wazuh-agent.msi /q ADDRESS='{{config.managerIp}}' AUTHD_SERVER='{{config.managerIp}}' + + Invoke-WebRequest -Uri https://packages.wazuh.com/3.x/windows/wazuh-agent-{{wazuhVersion}}-1.msi -OutFile wazuh-agent.msi; wazuh-agent.msi /q ADDRESS='{{config.managerIp}}' AUTHD_SERVER='{{config.managerIp}} PASSWORD='{{config.wazuhPassword}}' ' + + + Invoke-WebRequest -Uri https://packages.wazuh.com/3.x/windows/wazuh-agent-{{wazuhVersion}}-1.msi -OutFile wazuh-agent.msi; wazuh-agent.msi /q ADDRESS='{{config.managerIp}}' AUTHD_SERVER='{{config.managerIp}} ' +
@@ -106,7 +135,12 @@ Copy to clipboard - curl -so wazuh-agent.pkg https://packages.wazuh.com/3.x/osx/wazuh-agent-{{wazuhVersion}}-1.pkg && sudo launchctl setenv WAZUH_MANAGER_IP '{{config.managerIp}}' && sudo installer -pkg ./wazuh-agent.pkg -target / + + curl -so wazuh-agent.pkg https://packages.wazuh.com/3.x/osx/wazuh-agent-{{wazuhVersion}}-1.pkg && sudo launchctl setenv WAZUH_MANAGER_IP '{{config.managerIp}}' setenv WAZUH_PASSWORD '{{config.wazuhPassword}}' && sudo installer -pkg ./wazuh-agent.pkg -target / + + + curl -so wazuh-agent.pkg https://packages.wazuh.com/3.x/osx/wazuh-agent-{{wazuhVersion}}-1.pkg && sudo launchctl setenv WAZUH_MANAGER_IP '{{config.managerIp}}' && sudo installer -pkg ./wazuh-agent.pkg -target / +
diff --git a/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.js b/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.js index 2f1a3c3c5..630c17a51 100644 --- a/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.js +++ b/SplunkAppForWazuh/appserver/static/js/directives/wz-register-agent/wz-register-agent.js @@ -18,15 +18,43 @@ define(['../module'], function(directives) { scope: {}, controller($scope, $notificationService, $requestService) { const apiReq = $requestService.apiReq + + /** + * Obtain the current selected API from the session storage and removes the "http://" or "https://" from the URL + */ + this.getSelectedApi = () => { + var api_url = window.sessionStorage.selectedAPI ? JSON.parse(window.sessionStorage.selectedAPI).url : '' + const numToClean = api_url.startsWith('https://') ? 8 : 7; + api_url = api_url.substr(numToClean); + $scope.managerAddress = api_url + return api_url + } + + this.isPasswordNeeded = async () => { + try{ + $scope.isLoading = true + const result = await $requestService.apiReq('/agents/000/config/auth/auth') + const auth = ((result.data || {}).data || {}).auth || {}; + const usePassword = auth.use_password === 'yes'; + $scope.passwordNeeded = usePassword; + } catch (error) { + $scope.passwordNeeded = false; + } + $scope.isLoading = false + $scope.$applyAsync() + } + $scope.config = { osSelected: 'redhat', - managerIp: '', + managerIp: this.getSelectedApi(), + wazuhPassword: '', agentName: '', agentKey: '' } $scope.newInstall = true $scope.registeredAgent = false $scope.showNavTab = false + this.isPasswordNeeded() // Functions $scope.selectOs = os => { @@ -49,6 +77,11 @@ define(['../module'], function(directives) { $scope.$applyAsync() } + $scope.selectWazuhPassword = wazuhPassword => { + $scope.config.wazuhPassword = wazuhPassword + $scope.$applyAsync() + } + $scope.selectAgentName = agentName => { $scope.config.agentName = agentName $scope.registeredAgent = false @@ -86,7 +119,7 @@ define(['../module'], function(directives) { ) } } - + $scope.getVersion = async () => { $scope.wazuhVersion = await $requestService.apiReq('/version') $scope.wazuhVersion = ((($scope.wazuhVersion || {}).data || {}).data || {})