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

nixos/systemd: set r-x group permissions on /var/log/journal #22503

Closed
wants to merge 1 commit into from

Conversation

nlewo
Copy link
Member

@nlewo nlewo commented Feb 6, 2017

This allows services such as systemd-journal-gateway to access the
systemd journal.

Closes #22288

Motivation for this change
Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@nlewo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @ericsagnes and @globin to be potential reviewers.

@abbradar
Copy link
Member

abbradar commented Feb 7, 2017

Notice the comment. I think it may be broken because we remove several dependencies of systemd-tmpfiles to fix something inside NixOps. See also #4825.

@abbradar
Copy link
Member

abbradar commented Feb 7, 2017

BTW,

drwxr-sr-x+ 1 root systemd-journal      64 Sep 11  2015 journal

So indeed, it seems that tmpfiles has failed to set permissions up correctly for you.

@nlewo
Copy link
Member Author

nlewo commented Feb 7, 2017

@abbradar I think my problem is not related to the issue you mentionned. Even once systemd-tmpfiles has been executed, I still have the issue.

The problem comes from ACLs. getfacl /var/log/journal shows that the ACL for group is empty. Do you confirm this behavior?

In the folliowing I jsut provide some elements but I don't know yet from where comes the problem (our side or systemd side)!

more /etc/tmpfiles.d/* | grep "/var/log/journal " | cat -n
     1	z /var/log/journal 2755 root systemd-journal - -
     2	a+ /var/log/journal    - - - - d:group:adm:r-x,d:group:wheel:r-x
     3	a+ /var/log/journal    - - - - group:adm:r-x,group:wheel:r-x

It seems to me line 1 is executed after lines 2 and 3. In this case, the ACL for group is inherited from chmod permissions...

@abbradar
Copy link
Member

abbradar commented Feb 7, 2017

My ACL seems to be correct:

 ~  getfacl /var/log/journal 
getfacl: Removing leading '/' from absolute path names
# file: var/log/journal
# owner: root
# group: systemd-journal
# flags: -s-
user::rwx
group::r-x
group:wheel:r-x
group:adm:r-x
mask::r-x
other::r-x
default:user::rwx
default:group::r-x
default:group:wheel:r-x
default:group:adm:r-x
default:mask::r-x
default:other::r-x

So systemd-tmpfiles failed to set ACL for you for some reason. Anyway, if even after rerun of systemd-tmpfiles you see no change it seems that the issue is unrelated.

@nlewo
Copy link
Member Author

nlewo commented Feb 7, 2017

I opened the issue systemd/systemd#5264 to see what systemd guys think about my problem... FYI, there is also a more detailled description of this issue.

Otherwise, Archlinux chmod 2755 the file /var/log/journal (see https://git.archlinux.org/svntogit/packages.git/tree/systemd/trunk/PKGBUILD#n192).
So, maybe we could do a chmod 750 to fix this issue? ;)

@abbradar did you tryied a fresh installation of systemd >= 231? Because I didn't have this problem with systemd 217.

This allows services such as systemd-journal-gateway to access the
systemd journal.

Closes NixOS#22288
@nlewo
Copy link
Member Author

nlewo commented Feb 8, 2017

@abbradar A fix has been merged in systemd and would be available in systemd v233.

I then added a FIXME comment in our systemd module that says we could remove rights when we use systemd v233.

@abbradar
Copy link
Member

abbradar commented Feb 8, 2017

@nlewo Thank you very much for your investigation! Pushed that as 9d30099 (fixed comment identation and clarified it a bit).

Hopefully when #4825 is fixed we can just have systemd-tmpfiles do the right thing without creating anything by ourselves.

@abbradar abbradar closed this Feb 8, 2017
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.

None yet

3 participants