Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD info to Deploy new agent section #5413

Open
wants to merge 1 commit into
base: 4.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const ASSETS_PUBLIC_URL = '/plugins/wazuh/public/assets/';
// Reports
export const REPORTS_LOGO_IMAGE_ASSETS_RELATIVE_PATH = 'images/logo_reports.png';
export const REPORTS_PRIMARY_COLOR = '#256BD1';
export const REPORTS_PAGE_FOOTER_TEXT = 'Copyright © 2022 Wazuh, Inc.';
export const REPORTS_PAGE_FOOTER_TEXT = 'Copyright © 2023 Wazuh, Inc.';
export const REPORTS_PAGE_HEADER_TEXT = '[email protected]\nhttps://wazuh.com';

// Plugin platform
Expand All @@ -289,7 +289,7 @@ export const PLUGIN_PLATFORM_INSTALLATION_USER_GROUP = 'wazuh-dashboard';
export const PLUGIN_PLATFORM_WAZUH_DOCUMENTATION_URL_PATH_UPGRADE_PLATFORM = 'upgrade-guide';
export const PLUGIN_PLATFORM_WAZUH_DOCUMENTATION_URL_PATH_TROUBLESHOOTING = 'user-manual/wazuh-dashboard/troubleshooting.html';
export const PLUGIN_PLATFORM_WAZUH_DOCUMENTATION_URL_PATH_APP_CONFIGURATION = 'user-manual/wazuh-dashboard/config-file.html';
export const PLUGIN_PLATFORM_URL_GUIDE = 'https://opensearch.org/docs/1.2/opensearch/index/';
export const PLUGIN_PLATFORM_URL_GUIDE = 'https://opensearch.org/docs/2.6/';
export const PLUGIN_PLATFORM_URL_GUIDE_TITLE = 'OpenSearch guide';

export const PLUGIN_PLATFORM_REQUEST_HEADERS = {
Expand Down
2 changes: 2 additions & 0 deletions public/controllers/agent/components/agents-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ export const AgentsTable = withErrorBoundary(
icon = 'windows';
} else if (os?.platform === 'darwin') {
icon = 'apple';
} else if (os?.platform === 'freebsd') {
icon = 'freebsd';
}
const os_name =
checkField(agent?.os?.name) +
Expand Down
112 changes: 107 additions & 5 deletions public/controllers/agent/components/register-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
architectureButtonsWithPPC64LE,
architectureButtonsAix,
architectureButtonsHpUx,
architectureButtonsFreeBSD,
versionButtonAmazonLinux,
versionButtonsRedHat,
versionButtonsCentos,
Expand All @@ -67,6 +68,7 @@ import {
versionButtonsSolaris,
versionButtonsAix,
versionButtonsHPUX,
versionButtonsFreeBSD,
versionButtonAlpine,
architectureButtonsWithPPC64LEAlpine,
} from '../wazuh-config';
Expand Down Expand Up @@ -157,6 +159,7 @@ export const RegisterAgent = withErrorBoundary(
versionButtonsSuse,
versionButtonsAix,
versionButtonsHPUX,
versionButtonsFreeBSD,
versionButtonsOracleLinux,
versionButtonsRaspbian,
versionButtonFedora,
Expand All @@ -166,6 +169,7 @@ export const RegisterAgent = withErrorBoundary(
architectureButtonsSolaris,
architectureButtonsAix,
architectureButtonsHpUx,
architectureButtonsFreeBSD,
architectureButtonsMacos,
architectureButtonsWithPPC64LE,
wazuhPassword,
Expand Down Expand Up @@ -261,7 +265,10 @@ export const RegisterAgent = withErrorBoundary(
this.state.selectedVersion === 'oraclelinux6' ||
this.state.selectedVersion === 'amazonlinux1' ||
this.state.selectedVersion === 'debian7' ||
this.state.selectedVersion === 'ubuntu14'
this.state.selectedVersion === 'ubuntu14' ||
this.state.selectedVersion === 'freebsd12' ||
this.state.selectedVersion === 'freebsd13' ||
this.state.selectedVersion === 'freebsd14'
) {
return 'service wazuh-agent start';
} else return '';
Expand Down Expand Up @@ -703,6 +710,16 @@ export const RegisterAgent = withErrorBoundary(
}
}

resolveFreeBSDPackage() {
switch (
`${this.state.selectedVersion}-${this.state.selectedArchitecture}`
) {
default:
return `Installation from FreeBSD package: pkg install wazuh-agent`;
}
}


resolveAIXPackage() {
switch (
`${this.state.selectedVersion}-${this.state.selectedArchitecture}`
Expand Down Expand Up @@ -743,6 +760,8 @@ export const RegisterAgent = withErrorBoundary(
return this.resolveAIXPackage();
case 'hp':
return this.resolveHPPackage();
case 'freebsd':
return this.resolveFreeBSDPackage();
case 'amazonlinux':
return this.resolveAMAZONLPackage();
case 'fedora':
Expand Down Expand Up @@ -835,6 +854,13 @@ export const RegisterAgent = withErrorBoundary(
? ['OS architecture']
: []),
];
case 'freebsd':
return [
...(!this.state.selectedVersion ? ['OS version'] : []),
...(this.state.selectedVersion && !this.state.selectedArchitecture
? ['OS architecture']
: []),
];
case 'amazonlinux':
return [
...(!this.state.selectedVersion ? ['OS version'] : []),
Expand Down Expand Up @@ -905,6 +931,8 @@ export const RegisterAgent = withErrorBoundary(
appVersionMajorDotMinor,
);

const urlWazuhFreeBSDPortsPackages = 'https://ports.freebsd.org/cgi/ports.cgi?query=wazuh&stype=all';

const urlWindowsPackage = `https://packages.wazuh.com/4.x/windows/wazuh-agent-${this.state.wazuhVersion}-1.msi`;

const missingOSSelection = this.checkMissingOSSelection();
Expand Down Expand Up @@ -1007,6 +1035,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
}`,
aixText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}rpm -ivh ${this.optionalPackages()}`,
hpText: `cd / && sudo curl -so wazuh-agent.tar ${this.optionalPackages()} && sudo groupadd wazuh && sudo useradd -G wazuh wazuh && sudo tar -xvf wazuh-agent.tar`,
freebsdText: `${this.optionalPackages()} or from FreeBSD ports: cd /usr/ports/security/wazuh-agent && make install clean clean-depends`,
amazonlinuxText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`,
fedoraText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`,
oraclelinuxText: `sudo ${this.optionalDeploymentVariables()}${this.agentNameVariable()}yum install -y ${this.optionalPackages()}`,
Expand Down Expand Up @@ -1152,7 +1181,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
<EuiCodeBlock style={codeBlock} language={language}>
{this.state.wazuhPassword &&
!this.state.showPassword &&
!['sol', 'hp', 'alpine'].includes(this.state.selectedOS)
!['freebsd','sol', 'hp', 'alpine'].includes(this.state.selectedOS)
? this.obfuscatePassword(text)
: text}
</EuiCodeBlock>
Expand Down Expand Up @@ -1189,6 +1218,41 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
</span>
}
></EuiCallOut>
<EuiSpacer size='m' />
<EuiCallOut
color='warning'
className='message'
iconType='iInCircle'
title={
<span>
After installing the agent, you need to enroll it in the
Wazuh server. Check the Wazuh agent enrollment{' '}
<EuiLink target='_blank' href={urlWazuhAgentEnrollment}>
Wazuh agent enrollment
</EuiLink>{' '}
section to learn more.
</span>
}
></EuiCallOut>
</>
) : this.state.selectedVersion == 'freebsd12' ||
this.state.selectedVersion == 'freebsd13' ||
this.state.selectedVersion == 'freebsd14' ? (
<>
<EuiCallOut
color='warning'
className='message'
iconType='iInCircle'
title={
<span>
The Wazuh ports and packages are an effort of FreeBSD community for help to Wazuh users to install or test it on FreeBSD or derived projects. Check about Wazuh ports or packages on FreeBSD{' '}
<EuiLink target='_blank' href={urlWazuhFreeBSDPortsPackages}>
here
</EuiLink>.{' '} Take on mind FreeBSD is not officially supported by Wazuh Inc.
</span>
}
></EuiCallOut>

<EuiSpacer size='m' />
<EuiCallOut
color='warning'
Expand Down Expand Up @@ -1339,7 +1403,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
''
)}
{this.state.needsPassword &&
!['sol', 'hp', 'alpine'].includes(this.state.selectedOS) ? (
!['freebsd','sol', 'hp', 'alpine'].includes(this.state.selectedOS) ? (
<EuiSwitch
label='Show password'
checked={this.state.showPassword}
Expand Down Expand Up @@ -1539,7 +1603,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
serverAddress: nodeSelected,
udpProtocol: this.state.haveUdpProtocol,
connectionSecure: this.state.haveConnectionSecure
});
});
};

const steps = [
Expand Down Expand Up @@ -1749,6 +1813,21 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
},
]
: []),
...(this.state.selectedOS == 'freebsd'
? [
{
title: 'Choose the version',
children: (
<RegisterAgentButtonGroup
legend='Choose the version'
options={versionButtonsFreeBSD}
idSelected={this.state.selectedVersion}
onChange={version => this.setVersion(version)}
/>
),
},
]
: []),
...(this.state.selectedOS == 'aix'
? [
{
Expand Down Expand Up @@ -1950,6 +2029,25 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
},
]
: []),
...(this.state.selectedVersion == 'freebsd12' ||
this.state.selectedVersion == 'freebsd13' ||
this.state.selectedVersion == 'freebsd14'
? [
{
title: 'Choose the architecture',
children: (
<RegisterAgentButtonGroup
legend='Choose the architecture'
options={architectureButtonsFreeBSD}
idSelected={this.state.selectedArchitecture}
onChange={architecture =>
this.setArchitecture(architecture)
}
/>
),
},
]
: []),
...(this.state.selectedVersion == '6.1 TL9'
? [
{
Expand Down Expand Up @@ -1985,6 +2083,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
]
: []),
...(!(
this.state.selectedOS == 'freebsd' ||
this.state.selectedOS == 'hp' ||
this.state.selectedOS == 'sol' ||
this.state.selectedOS == 'alpine'
Expand Down Expand Up @@ -2018,6 +2117,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
]
: []),
...(!(
this.state.selectedOS == 'freebsd' ||
this.state.selectedOS == 'hp' ||
this.state.selectedOS == 'sol' ||
this.state.selectedOS == 'alpine'
Expand Down Expand Up @@ -2071,6 +2171,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
this.state.selectedOS == 'sol' ||
this.state.selectedOS == 'aix' ||
this.state.selectedOS == 'hp' ||
this.state.selectedOS == 'freebsd' ||
this.state.selectedOS == 'alpine' ||
this.state.selectedOS == ''
? [
Expand All @@ -2079,7 +2180,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
children: this.state.gotErrorRegistrationServiceInfo ? (
calloutErrorRegistrationServiceInfo
) : this.state.agentNameError &&
!['hp', 'sol', 'alpine'].includes(this.state.selectedOS) ? (
!['freebsd','hp', 'sol', 'alpine'].includes(this.state.selectedOS) ? (
<EuiCallOut
color='danger'
title={'There are fields with errors. Please verify them.'}
Expand Down Expand Up @@ -2150,6 +2251,7 @@ apk add wazuh-agent=${this.state.wazuhVersion}-r1`,
this.state.selectedOS !== 'sol' &&
this.state.selectedOS !== 'aix' &&
this.state.selectedOS !== 'hp' &&
this.state.selecetdOS !== 'freebsd' &&
this.state.selectedOS !== 'amazonlinux' &&
this.state.selectedOS !== 'fedora' &&
this.state.selectedOS !== 'oraclelinux' &&
Expand Down
52 changes: 52 additions & 0 deletions public/controllers/agent/wazuh-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,35 @@ const architectureButtonsHpUx = [
},
];

const architectureButtonsFreeBSD = [
{
id: 'i386',
label: 'i386',
},
{
id: 'amd64',
label: 'amd64',
default: true
},
{
id: 'aarch64',
label: 'aarch64',
},
{
id: 'armv6',
label: 'armv6',
},
{
id: 'armv7',
label: 'armv7',
},
{
id: 'powerpc64',
label: 'powerpc64',
},
];


const versionButtonAmazonLinux = [
{
id: 'amazonlinux1',
Expand Down Expand Up @@ -299,6 +328,23 @@ const versionButtonAlpine = [
},
];

const versionButtonsFreeBSD = [
{
id: 'freebsd12',
label: 'FreeBSD 12.x',
},
{
id: 'freebsd13',
label: 'FreeBSD 13.x',
default: true
},
{
id: 'freebsd14',
label: 'FreeBSD 14.x',
},
];


/**
* Order the OS Buttons Alphabetically by label
* @param a
Expand Down Expand Up @@ -367,6 +413,10 @@ const osButtons = [
id: 'fedora',
label: 'Fedora',
},
{
id: 'freebsd',
label: 'FreeBSD',
},
{
id: 'oraclelinux',
label: 'Oracle Linux',
Expand Down Expand Up @@ -408,9 +458,11 @@ export {
versionButtonsSolaris,
versionButtonsAix,
versionButtonsHPUX,
versionButtonsFreeBSD,
architectureButtonsi386,
architectureButtonsSolaris,
architectureButtonsAix,
architectureButtonsHpUx,
architectureButtonsFreeBSD,
architectureButtonsWithPPC64LEAlpine,
};