diff --git a/public/controllers/agent/agents-preview.js b/public/controllers/agent/agents-preview.js index 98bf5dac6..17ff741b9 100644 --- a/public/controllers/agent/agents-preview.js +++ b/public/controllers/agent/agents-preview.js @@ -99,9 +99,11 @@ export class AgentsPreviewController { this.registerAgentsProps = { addNewAgent: flag => this.addNewAgent(flag), - getWazuhVersion: () => this.getWazuhVersion() + getWazuhVersion: () => this.getWazuhVersion(), + getCurrentApiAddress: () => this.getCurrentApiAddress(), + needsPassword: () => this.needsPassword() }; - + this.hasAgents = true; this.init = false; //Load this.load(); @@ -230,7 +232,12 @@ export class AgentsPreviewController { this.lastAgent = unique.lastAgent; this.summary = unique.summary; if (!this.lastAgent || !this.lastAgent.id) { - this.addNewAgent(true); + if (this.addingNewAgent === undefined) { + this.addNewAgent(true); + } + this.hasAgents = false; + } else { + this.hasAgents = true; } if (agentsTop.data.data === '') { @@ -285,6 +292,37 @@ export class AgentsPreviewController { ); } + /** + * Returns if the password is neccesary to register a new agent + */ + async needsPassword() { + try { + const result = await this.apiReq.request('GET', '/agents/000/config/auth/auth', {}); + const auth = ((result.data || {}).data || {}).auth || {}; + const usePassword = auth.use_password === 'yes'; + return usePassword; + + } catch (error) { + return false; + } + } + + /** + * Returns the current API address + */ + async getCurrentApiAddress() { + try { + const result = await this.genericReq.request('GET', '/elastic/apis'); + const entries = result.data || []; + const host = entries.filter(e => {return e._id == this.api}); + const url = host[0]._source.url; + const numToClean = url.startsWith('https://') ? 8 : 7; + return url.substr(numToClean); + } catch (error) { + return false; + } + } + /** * Returns the Wazuh version as x.y.z */ diff --git a/public/controllers/agent/components/register-agent.js b/public/controllers/agent/components/register-agent.js index 00f4592ae..aa8f824c7 100644 --- a/public/controllers/agent/components/register-agent.js +++ b/public/controllers/agent/components/register-agent.js @@ -39,15 +39,25 @@ export class RegisterAgent extends Component { this.state = { status: 'incomplete', selectedOS: '', - serverAddress: '' + serverAddress: '', + wazuhPassword: '' }; } async componentDidMount() { try { - this.wazuhVersion = await this.props.getWazuhVersion(); + const wazuhVersion = await this.props.getWazuhVersion(); + const apiAddress = await this.props.getCurrentApiAddress(); + const needsPassword = await this.props.needsPassword(); + this.setState({ + serverAddress: apiAddress, + needsPassword: needsPassword, + wazuhVersion: wazuhVersion + }) } catch (error) { - this.wazuhVersion = version; + this.setState({ + wazuhVersion: version + }) } } @@ -59,6 +69,21 @@ export class RegisterAgent extends Component { this.setState({ serverAddress: event.target.value }); } + setWazuhPassword(event) { + this.setState({ wazuhPassword: event.target.value }); + } + + /** + * Checks if the password is not needed, in that case remove the input password step + * @param {Array} steps + */ + cleanSteps(steps) { + if (this.state.needsPassword) return steps; + steps.splice(2,1); + return steps; + } + + render() { const rpmButton = ( ); + const passwordInput = ( + this.setWazuhPassword(event)} + /> + ); + const copyButton = { position: 'relative', float: 'right', @@ -112,10 +145,10 @@ export class RegisterAgent extends Component { zIndex: '100' }; const customTexts = { - rpmText: `sudo WAZUH_MANAGER_IP='${this.state.serverAddress}' yum install https://packages.wazuh.com/3.x/yum/wazuh-agent-${this.wazuhVersion}-1.x86_64.rpm`, - debText: `curl -so wazuh-agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.wazuhVersion}-1_amd64.deb && sudo WAZUH_MANAGER_IP='${this.state.serverAddress}' dpkg -i ./wazuh-agent.deb`, - macosText: `curl -so wazuh-agent.pkg https://packages.wazuh.com/3.x/osx/wazuh-agent-${this.wazuhVersion}-1.pkg && sudo launchctl setenv WAZUH_MANAGER_IP '${this.state.serverAddress}' && sudo installer -pkg ./wazuh-agent.pkg -target /`, - winText: `Invoke-WebRequest -Uri https://packages.wazuh.com/3.x/windows/wazuh-agent-${this.wazuhVersion}-1.msi -OutFile wazuh-agent.msi; wazuh-agent.msi /q ADDRESS='${this.state.serverAddress}' AUTHD_SERVER='${this.state.serverAddress}'` + rpmText: `sudo WAZUH_MANAGER_IP='${this.state.serverAddress}'${this.state.needsPassword ? ` WAZUH_PASSWORD='${this.state.wazuhPassword}' ` : ' '}yum install https://packages.wazuh.com/3.x/yum/wazuh-agent-${this.state.wazuhVersion}-1.x86_64.rpm`, + debText: `curl -so wazuh-agent.deb https://packages.wazuh.com/3.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${this.state.wazuhVersion}-1_amd64.deb && sudo WAZUH_MANAGER_IP='${this.state.serverAddress}'${this.state.needsPassword ? ` WAZUH_PASSWORD='${this.state.wazuhPassword}' ` : ' '} dpkg -i ./wazuh-agent.deb`, + macosText: `curl -so wazuh-agent.pkg https://packages.wazuh.com/3.x/osx/wazuh-agent-${this.state.wazuhVersion}-1.pkg && sudo launchctl setenv WAZUH_MANAGER_IP '${this.state.serverAddress}'${this.state.needsPassword ? ` setenv WAZUH_PASSWORD '${this.state.wazuhPassword}' ` : ' '} && sudo installer -pkg ./wazuh-agent.pkg -target /`, + winText: `Invoke-WebRequest -Uri https://packages.wazuh.com/3.x/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi -OutFile wazuh-agent.msi; wazuh-agent.msi /q ADDRESS='${this.state.serverAddress}' AUTHD_SERVER='${this.state.serverAddress}'${this.state.needsPassword ? ` PASSWORD='${this.state.wazuhPassword}' ` : ' '}` }; const field = `${this.state.selectedOS}Text`; @@ -166,6 +199,10 @@ export class RegisterAgent extends Component { title: 'Wazuh server address', children: {ipInput} }, + { + title: 'Wazuh password', + children: {passwordInput} + }, { title: 'Complete the installation', children: ( @@ -180,12 +217,12 @@ export class RegisterAgent extends Component { return (
- + -

Add a new agent

+

Deploy a new agent

@@ -202,7 +239,7 @@ export class RegisterAgent extends Component { - + @@ -216,5 +253,7 @@ export class RegisterAgent extends Component { RegisterAgent.propTypes = { addNewAgent: PropTypes.func, - getWazuhVersion: PropTypes.func + getWazuhVersion: PropTypes.func, + getCurrentApiAddress: PropTypes.func, + needsPassword: PropTypes.func }; diff --git a/public/templates/management/groups/groups.html b/public/templates/management/groups/groups.html index a6708a032..83ce55255 100644 --- a/public/templates/management/groups/groups.html +++ b/public/templates/management/groups/groups.html @@ -85,127 +85,71 @@
+
-
-
- - Cancel - - Apply changes - It is not - possible to apply changes of more than 500 additions or deletions -
- - -
- -
- - - +
+
+
+ + Cancel + + + + Apply changes + + + + It is not possible to apply changes of more than 500 additions or deletions + +
- -
-
+ +
+ +
+ + + +
+ + +
+
+
+ + +
- - + -
- - - - - -
- - -
-
- -
-
-
- - -
- - - - - - -
- - - {{error.id}}{{$last - ? '' : ', '}}: {{group[0].message}} - - - - -
+ +
- -
-
- - -
-
-
- - - - - - - - -
- +
-
- -
- + - - - - - -
-
-
- {{ filename }} - - +
+ + + + + + +
+ + + {{error.id}}{{$last + ? '' : ', '}}: {{group[0].message}} + + + +
+ +
+ +
+
+ + +
+
+
+ + + + + + + + +
+ + +
+
+ + +
+
+
+ + + + + + + +
-
+
+ {{ filename }} + + +
+
+
+
+
- -
-
- +{{currentAdding}} -{{currentDeleting}} - - +
+
+
+
+ + + No agents were added to this manager. + +
+
+ +
+
+ +{{currentAdding}} -{{currentDeleting}} + + +
+
diff --git a/public/templates/overview/footer.foot b/public/templates/overview/footer.foot new file mode 100644 index 000000000..2d8bb3eb2 --- /dev/null +++ b/public/templates/overview/footer.foot @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/public/templates/overview/overview-fim.html b/public/templates/overview/overview-fim.html index ed57b48ba..ee62f7c31 100644 --- a/public/templates/overview/overview-fim.html +++ b/public/templates/overview/overview-fim.html @@ -1,99 +1,116 @@ - +
+
+ +
+
+ +
+
+ + + No agents were added to this manager: + + + Deploy new agent + +
+ +
+ +
+ + + Alerts by action over time + + + + + + + + + +
+
+ + + Top 5 agents + + + + + + + + + + + + Events summary + + + + + + + + + + +
-
- - - Alerts by action over time - - - - - - - - - -
-
- - - Top 5 agents - - - - - - - - - - - - Events summary - - - - - - - - - - -
+
+ + + Rule distribution + + + + + + + + + -
- - - Rule distribution - - - - - - - - - - - - - Actions - - - - - - - - - - - - - Top 5 users - - - - - - - - - -
-
- - - Alerts summary - - - - - - - - - -
- \ No newline at end of file + + + Actions + + + + + + + + + + + + + Top 5 users + + + + + + + + + +
+
+ + + Alerts summary + + + + + + + + + +
+
diff --git a/public/templates/overview/overview-general.html b/public/templates/overview/overview-general.html index c60d54ee9..acf172c52 100644 --- a/public/templates/overview/overview-general.html +++ b/public/templates/overview/overview-general.html @@ -1,5 +1,5 @@ +ng-class="{'no-opacity': resultState !== 'ready' || !rendered}">
+ diff --git a/public/templates/overview/overview.head b/public/templates/overview/overview.head index e28bbf571..15b1051b4 100644 --- a/public/templates/overview/overview.head +++ b/public/templates/overview/overview.head @@ -1,80 +1,98 @@ -
- -
- -
- -
- Overview - / - {{ octrl.tabNames[octrl.tab] }} +
+
+ +
+
+
+ +
+ +
+ +
+ Overview + / + {{ octrl.tabNames[octrl.tab] }} +
+
+ + + + + + + +
+ + +
+ + + +
+ + +
+
-
- + - - - + +
+ +
+ - -
- - -
- + + + - -
- - -
- -
- + +
+
+
{{loadingStatus}}
+
+ - -
- -
- + +
+
+
{{reportStatus}}
+
+ - - - + +
+ +
- -
-
-
{{loadingStatus}}
-
- - - -
-
-
{{reportStatus}}
-
- - - -
- -
- \ No newline at end of file +
+
+ + + No agents were added to this manager: + + + Deploy new agent + +
+ +
+ \ No newline at end of file diff --git a/public/templates/overview/overview.pug b/public/templates/overview/overview.pug index 496468d78..6b637166b 100644 --- a/public/templates/overview/overview.pug +++ b/public/templates/overview/overview.pug @@ -15,4 +15,4 @@ include ./overview-aws.html include ./overview-virustotal.html include ./overview-osquery.html include ./overview-docker.html -include ../footer.foot +include ./footer.foot