Skip to content

Commit

Permalink
[8.x] [Cloud Security] Remove preconfigured Agentless policy solution…
Browse files Browse the repository at this point in the history
… and feature flag (elastic#197338) (elastic#201868)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Remove preconfigured Agentless policy solution and
feature flag (elastic#197338)](elastic#197338)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"seanrathier","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-25T19:00:42Z","message":"[Cloud
Security] Remove preconfigured Agentless policy solution and feature
flag
(elastic#197338)","sha":"655cb7933371ce07b717eb40c3691fbc5ca08933","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","Team:Fleet","v9.0.0","Team:Cloud
Security","backport:prev-minor","ci:project-deploy-security"],"number":197338,"url":"https://github.com/elastic/kibana/pull/197338","mergeCommit":{"message":"[Cloud
Security] Remove preconfigured Agentless policy solution and feature
flag
(elastic#197338)","sha":"655cb7933371ce07b717eb40c3691fbc5ca08933"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197338","number":197338,"mergeCommit":{"message":"[Cloud
Security] Remove preconfigured Agentless policy solution and feature
flag
(elastic#197338)","sha":"655cb7933371ce07b717eb40c3691fbc5ca08933"}},{"url":"https://github.com/elastic/kibana/pull/201865","number":201865,"branch":"8.17","state":"OPEN"}]}]
BACKPORT-->
  • Loading branch information
seanrathier authored Nov 27, 2024
1 parent 3426a7f commit a797902
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 512 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/fleet/common/constants/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,5 @@ export const LICENSE_FOR_SCHEDULE_UPGRADE = 'platinum';

export const DEFAULT_MAX_AGENT_POLICIES_WITH_INACTIVITY_TIMEOUT = 750;

export const AGENTLESS_POLICY_ID = 'agentless'; // the policy id defined here: https://github.com/elastic/project-controller/blob/main/internal/project/security/security_kibana_config.go#L86

export const AGENT_LOG_LEVELS = ['error', 'warning', 'info', 'debug'] as const;
export const DEFAULT_LOG_LEVEL = 'info' as const;
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/common/experimental_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const _allowedExperimentalValues = {
kafkaOutput: true,
outputSecretsStorage: true,
remoteESOutput: true,
agentless: false,
enableStrictKQLValidation: true,
subfeaturePrivileges: false,
advancedPolicySettings: true,
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/common/types/models/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,4 @@ export interface FleetServerPolicy {

export interface AgentlessApiResponse {
id: string;
region_id: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,8 @@ describe('PackagePolicyInputPanel', () => {
beforeEach(() => {
useAgentlessMock.mockReturnValue({
isAgentlessEnabled: true,
isAgentlessPackagePolicy: jest.fn(),
isAgentlessAgentPolicy: jest.fn(),
isAgentlessIntegration: jest.fn(),
isAgentlessApiEnabled: true,
isDefaultAgentlessPolicyEnabled: false,
});
});

Expand Down Expand Up @@ -395,11 +392,8 @@ describe('PackagePolicyInputPanel', () => {
beforeEach(() => {
useAgentlessMock.mockReturnValue({
isAgentlessEnabled: false,
isAgentlessPackagePolicy: jest.fn(),
isAgentlessAgentPolicy: jest.fn(),
isAgentlessIntegration: jest.fn(),
isAgentlessApiEnabled: true,
isDefaultAgentlessPolicyEnabled: false,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ export function useOnSubmit({
const [hasAgentPolicyError, setHasAgentPolicyError] = useState<boolean>(false);
const hasErrors = validationResults ? validationHasErrors(validationResults) : false;

const { isAgentlessIntegration, isAgentlessAgentPolicy, isAgentlessPackagePolicy } =
useAgentless();
const { isAgentlessIntegration, isAgentlessAgentPolicy } = useAgentless();

// Update agent policy method
const updateAgentPolicies = useCallback(
Expand Down Expand Up @@ -316,9 +315,7 @@ export function useOnSubmit({
(agentCount !== 0 ||
(agentPolicies.length === 0 && selectedPolicyTab !== SelectedPolicyTab.NEW)) &&
!(
isAgentlessIntegration(packageInfo) ||
isAgentlessPackagePolicy(packagePolicy) ||
isAgentlessAgentPolicy(overrideCreatedAgentPolicy)
isAgentlessIntegration(packageInfo) || isAgentlessAgentPolicy(overrideCreatedAgentPolicy)
) &&
formState !== 'CONFIRM'
) {
Expand Down Expand Up @@ -365,9 +362,7 @@ export function useOnSubmit({
: packagePolicy.policy_ids;

const shouldForceInstallOnAgentless =
isAgentlessAgentPolicy(createdPolicy) ||
isAgentlessIntegration(packageInfo) ||
isAgentlessPackagePolicy(packagePolicy);
isAgentlessAgentPolicy(createdPolicy) || isAgentlessIntegration(packageInfo);

const forceInstall = force || shouldForceInstallOnAgentless;

Expand All @@ -390,8 +385,7 @@ export function useOnSubmit({
const hasGoogleCloudShell = data?.item ? getCloudShellUrlFromPackagePolicy(data.item) : false;

// Check if agentless is configured in ESS and Serverless until Agentless API migrates to Serverless
const isAgentlessConfigured =
isAgentlessAgentPolicy(createdPolicy) || (data && isAgentlessPackagePolicy(data.item));
const isAgentlessConfigured = isAgentlessAgentPolicy(createdPolicy);

// Removing this code will disabled the Save and Continue button. We need code below update form state and trigger correct modal depending on agent count
if (hasFleetAddAgentsPrivileges && !isAgentlessConfigured) {
Expand Down Expand Up @@ -479,7 +473,6 @@ export function useOnSubmit({
selectedPolicyTab,
packagePolicy,
isAgentlessAgentPolicy,
isAgentlessPackagePolicy,
hasFleetAddAgentsPrivileges,
withSysMonitoring,
newAgentPolicy,
Expand Down
Loading

0 comments on commit a797902

Please sign in to comment.