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

Rename cron package to cronie for RHEL10 product #12463

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

mildas
Copy link
Contributor

@mildas mildas commented Oct 3, 2024

Description:

In RHEL, package is named cronie and cron is only alias. Use the cronie name for RHEL10 product.

Rationale:

In RHEL10, cron alias is not available.

Review Hints:

oscap xccdf eval --rule xccdf_org.ssgproject.content_rule_package_cron_installed ssg-rhel10-ds.xml and remove/install cronie on various RHEL versions

Copy link

github-actions bot commented Oct 3, 2024

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Oct 3, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:12463
This image was built from commit: 3e8ae2c

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:12463

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:12463 make deploy-local

@mildas
Copy link
Contributor Author

mildas commented Oct 3, 2024

Ok, cronie is not available on other distros. Moving to DRAFT for now

@mildas mildas marked this pull request as draft October 3, 2024 14:31
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Oct 3, 2024
@mildas mildas changed the title Rename cron package to cronie Rename cron package to cronie for RHEL10 product Oct 4, 2024
@mildas
Copy link
Contributor Author

mildas commented Oct 4, 2024

Updated to use cronie only in RHEL10 and leave other distros untouched.

@mildas mildas marked this pull request as ready for review October 4, 2024 09:19
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Oct 4, 2024
@mildas mildas added this to the 0.1.75 milestone Oct 4, 2024
@@ -42,5 +42,6 @@ template:
name: package_installed
vars:
pkgname: cron
pkgname@rhel10: cronie
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a pkgname@rhel10 key be added also in the template vars in rule service_cron_enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked RHEL distros and the service is named crond, not cron. Added new commit with the fix for RHEL distros

@jan-cerny jan-cerny self-assigned this Oct 4, 2024
Copy link

github-actions bot commented Oct 7, 2024

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled'.
--- xccdf_org.ssgproject.content_rule_service_cron_enabled
+++ xccdf_org.ssgproject.content_rule_service_cron_enabled
@@ -7,8 +7,8 @@
 preconfigured times. It is required by almost all systems to perform necessary
 maintenance tasks, such as notifying root of system activity.
 
-The cron service can be enabled with the following command:
-$ sudo systemctl enable cron.service
+The crond service can be enabled with the following command:
+$ sudo systemctl enable crond.service
 
 [reference]:
 11

OVAL for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- oval:ssg-service_cron_enabled:def:1
+++ oval:ssg-service_cron_enabled:def:1
@@ -1,7 +1,7 @@
 criteria AND
-criterion oval:ssg-test_service_cron_package_cron_installed:tst:1
+criterion oval:ssg-test_service_crond_package_cron_installed:tst:1
 criteria AND
-criterion oval:ssg-test_service_running_cron:tst:1
+criterion oval:ssg-test_service_running_crond:tst:1
 criteria OR
-criterion oval:ssg-test_multi_user_wants_cron:tst:1
-criterion oval:ssg-test_multi_user_wants_cron_socket:tst:1
+criterion oval:ssg-test_multi_user_wants_crond:tst:1
+criterion oval:ssg-test_multi_user_wants_crond_socket:tst:1

OCIL for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- ocil:ssg-service_cron_enabled_ocil:questionnaire:1
+++ ocil:ssg-service_cron_enabled_ocil:questionnaire:1
@@ -1,8 +1,8 @@
 
 
 Run the following command to determine the current status of the
-cron service:
-$ sudo systemctl is-active cron
+crond service:
+$ sudo systemctl is-active crond
 If the service is running, it should return the following: active
       Is it the case that ?
       
bash remediation for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- xccdf_org.ssgproject.content_rule_service_cron_enabled
+++ xccdf_org.ssgproject.content_rule_service_cron_enabled
@@ -2,9 +2,9 @@
 if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 SYSTEMCTL_EXEC='/usr/bin/systemctl'
-"$SYSTEMCTL_EXEC" unmask 'cron.service'
-"$SYSTEMCTL_EXEC" start 'cron.service'
-"$SYSTEMCTL_EXEC" enable 'cron.service'
+"$SYSTEMCTL_EXEC" unmask 'crond.service'
+"$SYSTEMCTL_EXEC" start 'crond.service'
+"$SYSTEMCTL_EXEC" enable 'crond.service'
 
 else
     >&2 echo 'Remediation is not applicable, nothing was done'

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- xccdf_org.ssgproject.content_rule_service_cron_enabled
+++ xccdf_org.ssgproject.content_rule_service_cron_enabled
@@ -1,13 +1,13 @@
-- name: Enable cron Service - Enable service cron
+- name: Enable cron Service - Enable service crond
   block:
 
   - name: Gather the package facts
     package_facts:
       manager: auto
 
-  - name: Enable cron Service - Enable Service cron
+  - name: Enable cron Service - Enable Service crond
     ansible.builtin.systemd:
-      name: cron
+      name: crond
       enabled: true
       state: started
       masked: false

blueprint remediation for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- xccdf_org.ssgproject.content_rule_service_cron_enabled
+++ xccdf_org.ssgproject.content_rule_service_cron_enabled
@@ -1,3 +1,3 @@
 
 [customizations.services]
-enabled = ["cron"]
+enabled = ["crond"]

puppet remediation for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- xccdf_org.ssgproject.content_rule_service_cron_enabled
+++ xccdf_org.ssgproject.content_rule_service_cron_enabled
@@ -1,7 +1,7 @@
-include enable_cron
+include enable_crond
 
-class enable_cron {
-  service {'cron':
+class enable_crond {
+  service {'crond':
     enable => true,
     ensure => 'running',
   }

kickstart remediation for rule 'xccdf_org.ssgproject.content_rule_service_cron_enabled' differs.
--- xccdf_org.ssgproject.content_rule_service_cron_enabled
+++ xccdf_org.ssgproject.content_rule_service_cron_enabled
@@ -1,2 +1,2 @@
 
-service enable cron
+service enable crond

Copy link

codeclimate bot commented Oct 7, 2024

Code Climate has analyzed commit 3e8ae2c and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 59.5% (0.0% change).

View more on Code Climate.

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked the built rules package_cron_installed and service_cron_enabled in rhel10 product.

@jan-cerny jan-cerny merged commit 3f0f19a into ComplianceAsCode:master Oct 8, 2024
97 of 100 checks passed
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants