Skip to content

Move /var/log permission changes to BSI#946

Closed
texasaggie97 wants to merge 3 commits intoni:nilrt/master/scarthgapfrom
texasaggie97:users/texasaggie97/log-rotate
Closed

Move /var/log permission changes to BSI#946
texasaggie97 wants to merge 3 commits intoni:nilrt/master/scarthgapfrom
texasaggie97:users/texasaggie97/log-rotate

Conversation

@texasaggie97
Copy link
Copy Markdown
Contributor

@texasaggie97 texasaggie97 commented Feb 19, 2026

Summary of Changes

  • Added su root adm to the global logrotate configuration so that logrotate
    accepts /var/log being owned by group adm with mode 0770, fixing the error:
    skipping "/var/log/dmesg" because parent directory has insecure permissions.
  • Updated /etc/default/volatiles/00_core entries in ni-configpersistentlogs
    to create /var/log with owner root:adm and mode 0770 (both persistent and
    volatile configurations).
  • Added a new SysV init script set_log_permissions.sh (runs at start priority 3)
    that enforces root:adm 0770 ownership and default ACLs on /var/log at boot
    time, keeping the base image consistent with the security hardening applied by
    nilrt-snac.
  • Added acl as a runtime dependency of ni-configpersistentlogs to ensure
    setfacl is available.

Justification

AB#3698573

The nilrt-snac security hardening script sets /var/log to root:adm 0770
with default ACLs. Without this change the base image is inconsistent with that
policy and logrotate fails on any log under /var/log with a misleading
"insecure permissions" error.

See this internal Teams chat for discussion regarding this change and how it would affect LabVIEW RT.

Testing

  • I have built the core package feed with this PR in place. (bitbake packagefeed-ni-core)

Procedure

@chaitu236 chaitu236 requested a review from a team February 23, 2026 16:10
@texasaggie97 texasaggie97 changed the title Users/texasaggie97/log rotate Move /var/log permission changes to BSI Feb 23, 2026
@texasaggie97 texasaggie97 force-pushed the users/texasaggie97/log-rotate branch 2 times, most recently from 2c3a5fc to 795f1e0 Compare February 23, 2026 20:22

if [ -d "${LOG_DIR}" ]; then
chown root:adm "${LOG_DIR}"
chmod 0770 "${LOG_DIR}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it ok removing rx permissions for others? I know that technical support report reads from this location and I don't remember if it's done as webserv or admin; have we tested that workflow?

@jpautler may also have more context on persistent logs implementation.

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.

We make this change in ownership in SNAC mode which is then causing issues with logrotate. This change moves that ownership change into the BSI so logrotate can be configured so that it will work in SNAC mode as well. If this is an issue for something, know that it will also be an issue when the target is configured for SNAC.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need to test technical support report workflow to ensure it's not broken. We should also spend some time figuring out if any other workflows will be broken (or already broken in SNAC).

@chaitu236 chaitu236 requested a review from jpautler February 24, 2026 22:41
Copy link
Copy Markdown
Contributor

@amstewart amstewart left a comment

Choose a reason for hiding this comment

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

Remember to clean up your commit messages to include the recipe in the commit subject and have a detailed description.


SRC_URI = "\
file://ni-configpersistentlogs \
file://set_log_permissions.sh \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The original /var/log permissions are applied by the populate-volatile initscript already - which reads its configuration from /etc/default/volatiles. Instead of adding another initscript that resets it later, we should just add a conf snippet to that location changing the ownership.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And you should make that change in our initscripts bbappend.

…distros that have this group as a defualt

Signed-off-by: Mark Silva <mark.silva@emerson.com>
Signed-off-by: Mark Silva <mark.silva@emerson.com>
…ent logs. This sets the group for /var/log to adm

Signed-off-by: Mark Silva <mark.silva@emerson.com>

Add update-rc.d-native to dependencies for ni-configpersistentlogs
@texasaggie97 texasaggie97 force-pushed the users/texasaggie97/log-rotate branch from 795f1e0 to 44ae2c5 Compare March 18, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants