Skip to content

Add syslog-ng rules as an alternative logging framework#14766

Open
israel-villar wants to merge 3 commits into
ComplianceAsCode:masterfrom
israel-villar:feat/syslogng-rules
Open

Add syslog-ng rules as an alternative logging framework#14766
israel-villar wants to merge 3 commits into
ComplianceAsCode:masterfrom
israel-villar:feat/syslogng-rules

Conversation

@israel-villar
Copy link
Copy Markdown
Contributor

Add four new rules for the syslog-ng logging framework under linux_os/guide/system/logging/syslogng/:

  • package_syslogng_installed: ensure syslog-ng is installed
  • service_syslogng_enabled: ensure the syslog-ng service is enabled
  • syslogng_nolisten: ensure syslog-ng is not configured to accept remote messages (OVAL checks for absence of tcp()/udp() source directives in /etc/syslog-ng/syslog-ng.conf)
  • syslogng_filecreatemode: ensure syslog-ng sets file creation mode to 0640 or more restrictive (OVAL uses direct regex match on the options { } block)

syslog-ng is an alternative to rsyslog and systemd-journal. These rules provide coverage for systems that use syslog-ng as their logging daemon, complementing the existing rsyslog rules.
Map the new rules to the existing syslog-ng component.

Description:

  • Add four new rules for the syslog-ng logging framework under
    linux_os/guide/system/logging/syslogng/:
    • package_syslogng_installed: ensure syslog-ng is installed
    • service_syslogng_enabled: ensure the syslog-ng service is enabled
    • syslogng_nolisten: ensure syslog-ng is not configured to accept
      remote messages (OVAL checks for absence of tcp()/udp() source
      directives in /etc/syslog-ng/syslog-ng.conf)
    • syslogng_filecreatemode: ensure syslog-ng sets file creation mode
      to 0640 or more restrictive (OVAL uses direct regex match on the
      options { } block)
  • Map the new rules to the existing syslog-ng component.

Rationale:

  • syslog-ng is an alternative to rsyslog and systemd-journal. These rules
    provide coverage for systems that use syslog-ng as their logging daemon,
    complementing the existing rsyslog rules.

Review Hints:

  • New group directory linux_os/guide/system/logging/syslogng/ with two
    group.yml files and four rule directories.
  • syslogng_filecreatemode OVAL uses a direct regex match instead of shell
    arithmetic to avoid the SCE /tmp noexec problem.
  • Build to verify: ./build_product debian13 --datastream-only

Add four new rules for the syslog-ng logging framework under
linux_os/guide/system/logging/syslogng/:

- package_syslogng_installed: ensure syslog-ng is installed
- service_syslogng_enabled: ensure the syslog-ng service is enabled
- syslogng_nolisten: ensure syslog-ng is not configured to accept
  remote messages (OVAL checks for absence of tcp()/udp() source
  directives in /etc/syslog-ng/syslog-ng.conf)
- syslogng_filecreatemode: ensure syslog-ng sets file creation mode
  to 0640 or more restrictive (OVAL uses direct regex match on the
  options { } block)

syslog-ng is an alternative to rsyslog and systemd-journal. These rules
provide coverage for systems that use syslog-ng as their logging daemon,
complementing the existing rsyslog rules.
Map the new rules to the existing syslog-ng component.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@openshift-ci openshift-ci Bot added the needs-ok-to-test Used by openshift-ci bot. label Jun 5, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 5, 2026

Hi @israel-villar. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -0,0 +1,29 @@
documentation_complete: true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This rule already exists in the project (linux_os/guide/system/logging/rsyslog_accepting_remote_messages/package_syslogng_installed/rule.yml). Also, the service_syslongng_enabled exists as well.

It makes sense to move these rules to a new directory, however, please make sure that the old location is removed in the PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right. I removed package_syslogng_installed and service_syslogng_enabled from syslog_accepting_remote_messages/; the canonical location is now linux_os/guide/system/logging/syslogng/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is also a yamllint error in the components/syslog-ng.yml (missing list indentation) and there are two long lines in service_syslogng_enabled/rule.yml which were fixed in a follow-up commit.

Comment on lines +11 to +12
The regex 0[0-6][0-4][0-7] covers octal values 0000-0647, all of which
are 0640 or more restrictive (no extra bits beyond owner=rw, group=r). -->
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

0647 isn't more restrictive than 0640

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right again, 0647 grants world read+write+execute and is not more restrictive than 0640. Fixed the regex from 0[0-6][0-4][0-7] to 0[0-6][0-4]0 so world bits are always zero

system thus to act as a log server.
If the system is not a log server, then such source entries should not
appear in the syslog-ng configuration files.
<br /><br />
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove the excess br tags

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,40 @@
documentation_complete: true

title: 'Ensure syslog-ng Does Not Accept Remote Messages Unless Acting As Log Server'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add test scenarios for this rule. It isn't templated and it contains non-trivial checks and remeditaions, therefore the project would strongly benefit from having some test scenarios.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now There are test scenarios for syslogng_nolisten: added no_network_drivers.pass.sh, tcp_driver_in_source.fail.sh, udp_driver_in_source.fail.sh, and network_driver_in_source.fail.sh

@@ -0,0 +1,34 @@
documentation_complete: true

title: 'Ensure syslog-ng Default File Permissions Configured'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add test scenarios for this rule.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test scenarios for syslogng_filecreatemode: added perm_set_0640.pass.sh, perm_set_more_restrictive.pass.sh, perm_not_set.fail.sh, and perm_too_permissive.fail.sh

@jan-cerny jan-cerny self-assigned this Jun 8, 2026
- Remove duplicate package_syslogng_installed and service_syslogng_enabled
  rules from rsyslog_accepting_remote_messages/; the canonical location is
  now linux_os/guide/system/logging/syslogng/
- Fix syslogng_filecreatemode OVAL: change perm() regex from 0[0-6][0-4][0-7]
  to 0[0-6][0-4]0 so world bits are always zero (0647 is not more restrictive
  than 0640)
- Remove trailing <br /> tags from syslogng_accepting_remote_messages/group.yml
- Add test scenarios for syslogng_nolisten: no_network_drivers.pass,
  tcp_driver_in_source.fail, udp_driver_in_source.fail,
  network_driver_in_source.fail
- Add test scenarios for syslogng_filecreatemode: perm_set_0640.pass,
  perm_set_more_restrictive.pass, perm_not_set.fail, perm_too_permissive.fail

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add 2-space indentation to list items in components/syslog-ng.yml and
add yamllint disable comments for long reference lines in service_syslogng_enabled/rule.yml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 8, 2026

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_syslogng_enabled'.
--- xccdf_org.ssgproject.content_rule_service_syslogng_enabled
+++ xccdf_org.ssgproject.content_rule_service_syslogng_enabled
@@ -3,7 +3,8 @@
 Enable syslog-ng Service
 
 [description]:
-The syslog-ng service (in replacement of rsyslog) provides syslog-style logging by default on Debian.
+The syslog-ng service (in replacement of rsyslog) provides syslog-style logging
+by default on Debian.
 
 The syslog-ng service can be enabled with the following command:
 $ sudo systemctl enable syslog-ng.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Used by openshift-ci bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants