foreman_openscap 7.1.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_openscap/locale/cs_CZ/foreman_openscap.js +517 -421
- data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +909 -813
- data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +517 -421
- data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +549 -453
- data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +917 -821
- data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +917 -821
- data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +557 -461
- data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +603 -507
- data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +908 -812
- data/app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js +1398 -0
- data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +705 -609
- data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +917 -821
- data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +707 -611
- data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +557 -461
- data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +908 -812
- data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +705 -609
- data/app/assets/javascripts/foreman_openscap/reports.js +5 -0
- data/app/controllers/arf_reports_controller.rb +23 -2
- data/app/helpers/arf_reports_helper.rb +17 -4
- data/app/models/concerns/foreman_openscap/host_extensions.rb +2 -0
- data/app/models/foreman_openscap/arf_report.rb +11 -2
- data/app/views/arf_reports/_output.html.erb +5 -1
- data/app/views/job_templates/run_openscap_remediation_-_ansible_default.erb +27 -0
- data/app/views/job_templates/run_openscap_remediation_-_script_default.erb +24 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20230912122310_add_fixes_to_message.rb +5 -0
- data/lib/foreman_openscap/engine.rb +18 -2
- data/lib/foreman_openscap/version.rb +1 -1
- data/lib/tasks/foreman_openscap_tasks.rake +5 -16
- data/locale/Makefile +3 -3
- data/locale/cs_CZ/foreman_openscap.edit.po +144 -16
- data/locale/cs_CZ/foreman_openscap.po +97 -1
- data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/de/foreman_openscap.edit.po +145 -17
- data/locale/de/foreman_openscap.po +98 -2
- data/locale/en/foreman_openscap.edit.po +144 -16
- data/locale/en/foreman_openscap.po +97 -1
- data/locale/en_GB/foreman_openscap.edit.po +144 -16
- data/locale/en_GB/foreman_openscap.po +97 -1
- data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/es/foreman_openscap.edit.po +145 -17
- data/locale/es/foreman_openscap.po +98 -2
- data/locale/foreman_openscap.pot +168 -16
- data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/fr/foreman_openscap.edit.po +145 -17
- data/locale/fr/foreman_openscap.po +98 -2
- data/locale/gl/foreman_openscap.edit.po +144 -16
- data/locale/gl/foreman_openscap.po +97 -1
- data/locale/it/foreman_openscap.edit.po +144 -16
- data/locale/it/foreman_openscap.po +97 -1
- data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ja/foreman_openscap.edit.po +145 -17
- data/locale/ja/foreman_openscap.po +98 -2
- data/locale/ka/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ka/foreman_openscap.edit.po +1863 -0
- data/locale/ka/foreman_openscap.po +1405 -0
- data/locale/ka/foreman_openscap.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ko/foreman_openscap.edit.po +145 -17
- data/locale/ko/foreman_openscap.po +98 -2
- data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/pt_BR/foreman_openscap.edit.po +145 -17
- data/locale/pt_BR/foreman_openscap.po +98 -2
- data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/ru/foreman_openscap.edit.po +145 -17
- data/locale/ru/foreman_openscap.po +98 -2
- data/locale/sv_SE/foreman_openscap.edit.po +144 -16
- data/locale/sv_SE/foreman_openscap.po +97 -1
- data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_CN/foreman_openscap.edit.po +145 -17
- data/locale/zh_CN/foreman_openscap.po +98 -2
- data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/zh_TW/foreman_openscap.edit.po +145 -17
- data/locale/zh_TW/foreman_openscap.po +98 -2
- data/webpack/components/EmptyState.js +6 -2
- data/webpack/components/OpenscapRemediationWizard/OpenscapRemediationSelectors.js +16 -0
- data/webpack/components/OpenscapRemediationWizard/OpenscapRemediationWizardContext.js +4 -0
- data/webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js +38 -0
- data/webpack/components/OpenscapRemediationWizard/WizardHeader.js +43 -0
- data/webpack/components/OpenscapRemediationWizard/constants.js +14 -0
- data/webpack/components/OpenscapRemediationWizard/helpers.js +33 -0
- data/webpack/components/OpenscapRemediationWizard/index.js +160 -0
- data/webpack/components/OpenscapRemediationWizard/steps/Finish.js +131 -0
- data/webpack/components/OpenscapRemediationWizard/steps/ReviewHosts.js +217 -0
- data/webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.js +176 -0
- data/webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.scss +4 -0
- data/webpack/components/OpenscapRemediationWizard/steps/SnippetSelect.js +160 -0
- data/webpack/components/OpenscapRemediationWizard/steps/index.js +4 -0
- data/webpack/index.js +8 -3
- data/webpack/testHelper.js +6 -5
- metadata +24 -3
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { map, split, capitalize, join, slice, isEmpty } from 'lodash';
|
|
3
|
+
import {
|
|
4
|
+
Form,
|
|
5
|
+
FormGroup,
|
|
6
|
+
FormSelect,
|
|
7
|
+
FormSelectOption,
|
|
8
|
+
Radio,
|
|
9
|
+
Alert,
|
|
10
|
+
} from '@patternfly/react-core';
|
|
11
|
+
|
|
12
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
|
13
|
+
import { STATUS } from 'foremanReact/constants';
|
|
14
|
+
import Loading from 'foremanReact/components/Loading';
|
|
15
|
+
|
|
16
|
+
import OpenscapRemediationWizardContext from '../OpenscapRemediationWizardContext';
|
|
17
|
+
import WizardHeader from '../WizardHeader';
|
|
18
|
+
import EmptyState from '../../EmptyState';
|
|
19
|
+
import { errorMsg, supportedRemediationSnippets } from '../helpers';
|
|
20
|
+
|
|
21
|
+
const SnippetSelect = () => {
|
|
22
|
+
const {
|
|
23
|
+
fixes,
|
|
24
|
+
snippet,
|
|
25
|
+
setSnippet,
|
|
26
|
+
method,
|
|
27
|
+
setMethod,
|
|
28
|
+
logStatus,
|
|
29
|
+
logError,
|
|
30
|
+
supportedJobSnippets,
|
|
31
|
+
} = useContext(OpenscapRemediationWizardContext);
|
|
32
|
+
|
|
33
|
+
const snippetNameMap = {
|
|
34
|
+
'urn:xccdf:fix:script:ansible': 'Ansible',
|
|
35
|
+
'urn:xccdf:fix:script:puppet': 'Puppet',
|
|
36
|
+
'urn:xccdf:fix:script:sh': 'Shell',
|
|
37
|
+
'urn:xccdf:fix:script:kubernetes': 'Kubernetes',
|
|
38
|
+
'urn:redhat:anaconda:pre': 'Anaconda',
|
|
39
|
+
'urn:redhat:osbuild:blueprint': 'OSBuild Blueprint',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const snippetName = system => {
|
|
43
|
+
const mapped = snippetNameMap[system];
|
|
44
|
+
if (mapped) return mapped;
|
|
45
|
+
|
|
46
|
+
return join(
|
|
47
|
+
map(slice(split(system, ':'), -2), n => capitalize(n)),
|
|
48
|
+
' '
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const resetSnippet = meth => {
|
|
53
|
+
const snip = supportedRemediationSnippets(
|
|
54
|
+
fixes,
|
|
55
|
+
meth,
|
|
56
|
+
supportedJobSnippets
|
|
57
|
+
)[0];
|
|
58
|
+
setSnippet(snip);
|
|
59
|
+
return snip;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const setMethodResetSnippet = meth => {
|
|
63
|
+
setMethod(meth);
|
|
64
|
+
resetSnippet(meth);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const body =
|
|
68
|
+
logStatus === STATUS.RESOLVED ? (
|
|
69
|
+
<Form>
|
|
70
|
+
<FormGroup
|
|
71
|
+
label={__('Method')}
|
|
72
|
+
type="string"
|
|
73
|
+
fieldId="method"
|
|
74
|
+
isRequired={false}
|
|
75
|
+
>
|
|
76
|
+
<Radio
|
|
77
|
+
label={__('Remote job')}
|
|
78
|
+
id="job"
|
|
79
|
+
name="job"
|
|
80
|
+
ouiaId="job"
|
|
81
|
+
aria-label="job"
|
|
82
|
+
isChecked={method === 'job'}
|
|
83
|
+
onChange={() => setMethodResetSnippet('job')}
|
|
84
|
+
/>
|
|
85
|
+
<Radio
|
|
86
|
+
label={__('Manual')}
|
|
87
|
+
id="manual"
|
|
88
|
+
name="manual"
|
|
89
|
+
ouiaId="manual"
|
|
90
|
+
aria-label="manual"
|
|
91
|
+
isChecked={method === 'manual'}
|
|
92
|
+
onChange={() => setMethodResetSnippet('manual')}
|
|
93
|
+
/>
|
|
94
|
+
</FormGroup>
|
|
95
|
+
{isEmpty(
|
|
96
|
+
supportedRemediationSnippets(fixes, method, supportedJobSnippets)
|
|
97
|
+
) ? (
|
|
98
|
+
<Alert
|
|
99
|
+
ouiaId="snippet-alert"
|
|
100
|
+
variant="info"
|
|
101
|
+
title={__(
|
|
102
|
+
'There is no job to remediate with. Please remediate manually.'
|
|
103
|
+
)}
|
|
104
|
+
/>
|
|
105
|
+
) : (
|
|
106
|
+
<FormGroup
|
|
107
|
+
label={__('Snippet')}
|
|
108
|
+
type="string"
|
|
109
|
+
fieldId="snippet"
|
|
110
|
+
isRequired
|
|
111
|
+
>
|
|
112
|
+
<FormSelect
|
|
113
|
+
ouiaId="snippet-select"
|
|
114
|
+
isRequired
|
|
115
|
+
value={snippet}
|
|
116
|
+
onChange={value => setSnippet(value)}
|
|
117
|
+
aria-label="FormSelect Input"
|
|
118
|
+
>
|
|
119
|
+
<FormSelectOption
|
|
120
|
+
isDisabled
|
|
121
|
+
key={0}
|
|
122
|
+
value=""
|
|
123
|
+
label={__('Select snippet')}
|
|
124
|
+
/>
|
|
125
|
+
{map(
|
|
126
|
+
supportedRemediationSnippets(
|
|
127
|
+
fixes,
|
|
128
|
+
method,
|
|
129
|
+
supportedJobSnippets
|
|
130
|
+
),
|
|
131
|
+
fix => (
|
|
132
|
+
<FormSelectOption
|
|
133
|
+
key={fix}
|
|
134
|
+
value={fix}
|
|
135
|
+
label={snippetName(fix)}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
)}
|
|
139
|
+
</FormSelect>
|
|
140
|
+
</FormGroup>
|
|
141
|
+
)}
|
|
142
|
+
</Form>
|
|
143
|
+
) : (
|
|
144
|
+
<EmptyState error title={__('Error!')} body={errorMsg(logError)} />
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<>
|
|
149
|
+
<WizardHeader
|
|
150
|
+
title={__('Select remediation method')}
|
|
151
|
+
description={__(
|
|
152
|
+
'You can remediate by running a remote job or you can display a snippet for manual remediation.'
|
|
153
|
+
)}
|
|
154
|
+
/>
|
|
155
|
+
{logStatus === STATUS.PENDING ? <Loading /> : body}
|
|
156
|
+
</>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export default SnippetSelect;
|
data/webpack/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import componentRegistry from 'foremanReact/components/componentRegistry';
|
|
2
2
|
|
|
3
3
|
import RuleSeverity from './components/RuleSeverity';
|
|
4
|
+
import OpenscapRemediationWizard from './components/OpenscapRemediationWizard';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
name: 'RuleSeverity',
|
|
7
|
-
type:
|
|
6
|
+
const components = [
|
|
7
|
+
{ name: 'RuleSeverity', type: RuleSeverity },
|
|
8
|
+
{ name: 'OpenscapRemediationWizard', type: OpenscapRemediationWizard },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
components.forEach(component => {
|
|
12
|
+
componentRegistry.register(component);
|
|
8
13
|
});
|
data/webpack/testHelper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Provider } from 'react-redux';
|
|
3
3
|
import store from 'foremanReact/redux';
|
|
4
4
|
import { MockedProvider } from '@apollo/react-testing';
|
|
@@ -19,20 +19,21 @@ export const withRouter = Component => props => (
|
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
export const withMockedProvider = Component => props => {
|
|
22
|
-
const ForemanContext = getForemanContext(ctx);
|
|
23
22
|
// eslint-disable-next-line react/prop-types
|
|
24
23
|
const { mocks, ...rest } = props;
|
|
25
24
|
|
|
26
|
-
const
|
|
25
|
+
const [context, setContext] = useState({
|
|
27
26
|
metadata: {
|
|
28
27
|
UISettings: {
|
|
29
28
|
perPage: 20,
|
|
30
29
|
},
|
|
31
30
|
},
|
|
32
|
-
};
|
|
31
|
+
});
|
|
33
32
|
|
|
33
|
+
const contextData = { context, setContext };
|
|
34
|
+
const ForemanContext = getForemanContext(contextData);
|
|
34
35
|
return (
|
|
35
|
-
<ForemanContext.Provider value={
|
|
36
|
+
<ForemanContext.Provider value={contextData}>
|
|
36
37
|
<MockedProvider mocks={mocks}>
|
|
37
38
|
<Component {...rest} />
|
|
38
39
|
</MockedProvider>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_openscap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- slukasik@redhat.com
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -44,6 +44,7 @@ files:
|
|
|
44
44
|
- app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js
|
|
45
45
|
- app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js
|
|
46
46
|
- app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js
|
|
47
|
+
- app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js
|
|
47
48
|
- app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js
|
|
48
49
|
- app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js
|
|
49
50
|
- app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js
|
|
@@ -223,6 +224,8 @@ files:
|
|
|
223
224
|
- app/views/foreman_openscap/policy_mailer/_policy.erb
|
|
224
225
|
- app/views/foreman_openscap/policy_mailer/policy_summary.erb
|
|
225
226
|
- app/views/hosts/select_multiple_openscap_proxy.html.erb
|
|
227
|
+
- app/views/job_templates/run_openscap_remediation_-_ansible_default.erb
|
|
228
|
+
- app/views/job_templates/run_openscap_remediation_-_script_default.erb
|
|
226
229
|
- app/views/job_templates/run_openscap_scans.erb
|
|
227
230
|
- app/views/job_templates/run_oval_scans.erb
|
|
228
231
|
- app/views/policies/_form.html.erb
|
|
@@ -322,6 +325,7 @@ files:
|
|
|
322
325
|
- db/migrate/20201217161511_add_url_to_oval_content.rb
|
|
323
326
|
- db/migrate/20210409095625_add_oval_policy_reference_to_cve.rb
|
|
324
327
|
- db/migrate/20210819143316_drop_unused_tables.rb
|
|
328
|
+
- db/migrate/20230912122310_add_fixes_to_message.rb
|
|
325
329
|
- db/seeds.d/75-job_templates.rb
|
|
326
330
|
- db/seeds.d/openscap_feature.rb
|
|
327
331
|
- db/seeds.d/openscap_policy_notification.rb
|
|
@@ -372,6 +376,10 @@ files:
|
|
|
372
376
|
- locale/ja/foreman_openscap.edit.po
|
|
373
377
|
- locale/ja/foreman_openscap.po
|
|
374
378
|
- locale/ja/foreman_openscap.po.time_stamp
|
|
379
|
+
- locale/ka/LC_MESSAGES/foreman_openscap.mo
|
|
380
|
+
- locale/ka/foreman_openscap.edit.po
|
|
381
|
+
- locale/ka/foreman_openscap.po
|
|
382
|
+
- locale/ka/foreman_openscap.po.time_stamp
|
|
375
383
|
- locale/ko/LC_MESSAGES/foreman_openscap.mo
|
|
376
384
|
- locale/ko/foreman_openscap.edit.po
|
|
377
385
|
- locale/ko/foreman_openscap.po
|
|
@@ -470,6 +478,19 @@ files:
|
|
|
470
478
|
- webpack/components/IndexTable/IndexTableHelper.js
|
|
471
479
|
- webpack/components/IndexTable/index.js
|
|
472
480
|
- webpack/components/LinkButton.js
|
|
481
|
+
- webpack/components/OpenscapRemediationWizard/OpenscapRemediationSelectors.js
|
|
482
|
+
- webpack/components/OpenscapRemediationWizard/OpenscapRemediationWizardContext.js
|
|
483
|
+
- webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js
|
|
484
|
+
- webpack/components/OpenscapRemediationWizard/WizardHeader.js
|
|
485
|
+
- webpack/components/OpenscapRemediationWizard/constants.js
|
|
486
|
+
- webpack/components/OpenscapRemediationWizard/helpers.js
|
|
487
|
+
- webpack/components/OpenscapRemediationWizard/index.js
|
|
488
|
+
- webpack/components/OpenscapRemediationWizard/steps/Finish.js
|
|
489
|
+
- webpack/components/OpenscapRemediationWizard/steps/ReviewHosts.js
|
|
490
|
+
- webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.js
|
|
491
|
+
- webpack/components/OpenscapRemediationWizard/steps/ReviewRemediation.scss
|
|
492
|
+
- webpack/components/OpenscapRemediationWizard/steps/SnippetSelect.js
|
|
493
|
+
- webpack/components/OpenscapRemediationWizard/steps/index.js
|
|
473
494
|
- webpack/components/RuleSeverity/RuleSeverity.scss
|
|
474
495
|
- webpack/components/RuleSeverity/RuleSeverity.test.js
|
|
475
496
|
- webpack/components/RuleSeverity/__snapshots__/RuleSeverity.test.js.snap
|
|
@@ -566,7 +587,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
566
587
|
- !ruby/object:Gem::Version
|
|
567
588
|
version: '0'
|
|
568
589
|
requirements: []
|
|
569
|
-
rubygems_version: 3.
|
|
590
|
+
rubygems_version: 3.2.33
|
|
570
591
|
signing_key:
|
|
571
592
|
specification_version: 4
|
|
572
593
|
summary: Foreman plug-in for displaying OpenSCAP audit reports
|