Skip to content

Commit

Permalink
Merge pull request #307 from Security-Onion-Solutions/jertel/dlwarn
Browse files Browse the repository at this point in the history
show warning on downloads screen for eval/import nodes
  • Loading branch information
jertel authored Dec 21, 2023
2 parents c58cfea + 68e6e72 commit c717bf7
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
5 changes: 3 additions & 2 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1098,10 +1098,11 @@ <h2 v-text="i18n.licensing"></h2>
<h2 v-text="i18n.downloads"></h2>
</v-col>
</v-row>
<v-alert type="info" v-html="i18n.downloadsFirewallTip"></v-alert>
<v-row>
<v-col>
<h3 class="mt-2" v-text="i18n.downloadsElasticAgent" id="download-elasticagent"></h3>
<h3 class="my-2" v-text="i18n.downloadsElasticAgent" id="download-elasticagent"></h3>
<v-alert v-if="remoteAgentSupported" type="info" v-html="i18n.downloadsFirewallTip"></v-alert>
<v-alert v-else type="error" v-html="i18n.downloadsAgentUnavailable"></v-alert>
<ul>
<li><a href="/packages/so-elastic-agent_windows_amd64" download="so-elastic-agent_windows_amd64.exe">Windows x86_64 Installer</a></li>
<li><a href="/packages/so-elastic-agent_linux_amd64" download="so-elastic-agent_linux_amd64">Linux x86_64 Installer</a></li>
Expand Down
1 change: 1 addition & 0 deletions html/js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ const i18n = {
diskUsageRoot: 'Disk Usage Root',
diskUsageRootAbbr: 'Root',
downloads: 'Downloads',
downloadsAgentUnavailable: 'Evaluation installs and Import installs do not support remote elastic agents. The links below are shown for demonstration purposes only.',
downloadsFirewallTip: 'When installing the Elastic Agent onto remote systems, be sure to <a href="/#/config?s=firewall.hostgroups.elastic_agent_endpoint">allow network access through the firewall</a>.',
downloadsInfo: 'These <a href="/docs/elastic-agent.html">Elastic Agent</a> installers are customized for this specific <a href="/docs/elastic-fleet.html">Elastic Fleet</a> installation. These files are not signed. If you need signed non-customized Elastic Agent installers, you can get them from <a href="https://www.elastic.co/downloads/elastic-agent">elastic.co</a>.',
downloadsElasticAgent: 'Elastic Agent Installers',
Expand Down
10 changes: 10 additions & 0 deletions html/js/routes/downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ routes.push({ path: '/downloads', name: 'downloads', component: {
template: '#page-downloads',
data() { return {
i18n: this.$root.i18n,
remoteAgentSupported: true,
}},
created() {
this.$root.subscribe("node", this.updateNode);
},
destroyed() {
this.$root.unsubscribe("node", this.updateNode);
},
watch: {
},
methods: {
updateNode(node) {
if (['so-eval', 'so-import'].includes(node.role)) {
this.remoteAgentSupported = false;
}
},
}
}});
34 changes: 34 additions & 0 deletions html/js/routes/downloads.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2019 Jason Ertel (github.com/jertel).
// Copyright 2020-2023 Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
// or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
// https://securityonion.net/license; you may not use this file except in compliance with the
// Elastic License 2.0.

require('../test_common.js');
require('./downloads.js');

const comp = getComponent("downloads");

test('updateNode', () => {
expect(comp.remoteAgentSupported).toBe(true);

comp.remoteAgentSupported = true;
comp.updateNode({ role: 'so-import'});
expect(comp.remoteAgentSupported).toBe(false);

comp.remoteAgentSupported = true;
comp.updateNode({ role: 'so-eval'});
expect(comp.remoteAgentSupported).toBe(false);

comp.remoteAgentSupported = true;
comp.updateNode({ role: 'so-standalone'});
expect(comp.remoteAgentSupported).toBe(true);

comp.remoteAgentSupported = true;
comp.updateNode({ role: 'so-manager'});
expect(comp.remoteAgentSupported).toBe(true);

comp.remoteAgentSupported = true;
comp.updateNode({ role: 'so-managersearch'});
expect(comp.remoteAgentSupported).toBe(true);
});

0 comments on commit c717bf7

Please sign in to comment.