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

ejabberd: refactor module, add test #59731

Merged
merged 4 commits into from Apr 27, 2019
Merged

Conversation

ajs124
Copy link
Member

@ajs124 ajs124 commented Apr 16, 2019

Motivation for this change

I run ejabberd.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@dotlambda
Copy link
Member

Can't we use tmpfiles for e.g. creating /var/lock/ejabberdctl and then run the complete unit as the correct user? See also #56265.

client = { nodes, pkgs, ... }: {
environment.systemPackages = let
sendMessage = pkgs.writeScriptBin "send-message" ''
#!/usr/bin/env python3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#!/usr/bin/env python3
#! ${(pkgs.python3.withPackages (ps: [ ps.sleekxmpp ])).interpreter}

Copy link
Member Author

Choose a reason for hiding this comment

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

This python script is lifted from the prosody test, so this should probably be fixed there, as well.

Copy link
Member

Choose a reason for hiding this comment

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

It's not a necessity because both ways work fine. However, it would be nice to have a single file for the script.

Copy link
Member Author

Choose a reason for hiding this comment

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

How about something like this?

nixos/tests/ejabberd.nix Outdated Show resolved Hide resolved
nixos/tests/ejabberd.nix Outdated Show resolved Hide resolved
@aanderse
Copy link
Member

Can't we use tmpfiles for e.g. creating /var/lock/ejabberdctl and then run the complete unit as the correct user? See also #56265.

A big +1 on not using escalated privileges to launch this service.

@ajs124
Copy link
Member Author

ajs124 commented Apr 17, 2019

Seems like /var/lock/ejabberdctl is not needed for anything anymore, so I dropped that and converted the other two directories to tmpfiles.

nixos/tests/ejabberd.nix Outdated Show resolved Hide resolved
@ajs124 ajs124 force-pushed the ejabberd_test branch 2 times, most recently from 802f40c to b8d4914 Compare April 18, 2019 20:17
@aanderse
Copy link
Member

aanderse commented Apr 18, 2019

@GrahamcOfBorg test ejabberd
@GrahamcOfBorg test prosody

@ajs124
Copy link
Member Author

ajs124 commented Apr 19, 2019

How does that even happen? It worked on aarch64 but not x86_64? It works fine on my laptop and desktop.

@aanderse
Copy link
Member

How does that even happen? It worked on aarch64 but not x86_64? It works fine on my laptop and desktop.

Cookie file /var/lib/ejabberd/.erlang.cookie must be accessible by owner only
Sounds like your spoolDir needs to be created as 0700 and enforced.

@ajs124
Copy link
Member Author

ajs124 commented Apr 21, 2019

It's worth a try. I don't know if it makes a difference though, since it was already working for me on my machines.

I mean, how and why would the mode of the directory influence the mode of its contents?

@aanderse
Copy link
Member

It was just a guess based on the error message. With the current mode of the directory the file is accessible to more than just the owner.

I'm also confused by this error because it worked on my machine as well.

@aanderse
Copy link
Member

@ajs124 Fantastic work! 🎉
@dotlambda I'm very happy with this PR. Anything outstanding from your perspective?

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

Very nice! I did not test it though since I do not run ejabberd yet.
You might want to change the last commit message to use nixos/ejabberd.

@infinisil
Copy link
Member

@GrahamcOfBorg test ejabberd
@GrahamcOfBorg test prosody

@infinisil infinisil merged commit 77fb90d into NixOS:master Apr 27, 2019
@ajs124 ajs124 deleted the ejabberd_test branch April 29, 2019 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants