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/rspamd: Add support for included files #49620

Merged
merged 1 commit into from Nov 3, 2018

Conversation

griff
Copy link
Contributor

@griff griff commented Nov 2, 2018

Motivation for this change

By default rspamd will look for multiple files in /etc/rspamd/local.d
and /etc/rspamd/override.d to be included in subsections of the merged
final config for rspamd. Most of the config snippets in the official
rspamd documentation are made to these files and so it makes sense for
NixOS to support them and this is what this commit does by adding new options
locals and overrides.

As part of rspamd 1.8.1 support was added for having custom Lua
rules stored in $LOCAL_CONFDIR/rspamd.local.lua which means that it is
now possible for NixOS to support such rules and so this commit also
adds support for this to the rspamd module.

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 nox --run "nox-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)
  • Fits CONTRIBUTING.md.

By default rspamd will look for multiple files in /etc/rspamd/local.d
and /etc/rspamd/override.d to be included in subsections of the merged
final config for rspamd. Most of the config snippets in the official
rspamd documentation are made to these files and so it makes sense for
NixOS to support them and this is what this commit does.

As part of rspamd 1.8.1 support was added for having custom Lua
rules stored in $LOCAL_CONFDIR/rspamd.local.lua which means that it is
now possible for NixOS to support such rules and so this commit also
adds support for this to the rspamd module.
@joachifm
Copy link
Contributor

joachifm commented Nov 3, 2018

@GrahamcOfBorg test rspamd.customLuaRules

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.rspamd.customLuaRules

Partial log (click to expand)

syncing
machine: running command: sync
machine# [   67.962156] rspamd[794]: <06d4a2>; csession; rspamd_protocol_http_reply: regexp statistics: 29 pcre regexps scanned, 1 regexps matched, 177 regexps total, 11 regexps cached, 566B bytes scanned using pcre, 566B bytes scanned total
machine: exit status 0
test script finished in 70.14s
cleaning up
killing machine (pid 597)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/98r712izaq35i1hshdcs8rrw38zra3ah-vm-test-run-rspamd-custom-lua-rules

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tests.rspamd.customLuaRules

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 60.03s
cleaning up
killing machine (pid 631)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/76nmwa6sjd5n1yij4gg3abdh19r02w1a-vm-test-run-rspamd-custom-lua-rules

@joachifm
Copy link
Contributor

joachifm commented Nov 3, 2018

@GrahamcOfBorg test rspamd.simple

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tests.rspamd.simple

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 50.56s
cleaning up
killing machine (pid 631)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/68wsymi49prvnnsfwr7q6x1kflbqr7za-vm-test-run-rspamd-simple

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.rspamd.simple

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 60.11s
cleaning up
killing machine (pid 597)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/ynsa8h0i1v3rxxxhdp3zlyagi0r4l08c-vm-test-run-rspamd-simple

@joachifm joachifm merged commit 9c44eeb into NixOS:master Nov 3, 2018
@joachifm
Copy link
Contributor

joachifm commented Nov 3, 2018

Thank you

@griff griff deleted the rspamd-multifile branch November 5, 2018 16:57
griff added a commit to griff/nixpkgs that referenced this pull request Nov 5, 2018
When implementing NixOS#49620 I included an enable option for both the
locals and overrides options but the code writing the files didn't
actually look at enable and so would write the file regardless of its
value. I also set the type to loaOf which should have been attrsOf
since the code was not written to handle the options being lists.

This fixes both of those issues.
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

3 participants