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

sshguard + service: init at 2.0.0 #23697

Merged
merged 1 commit into from Apr 30, 2017
Merged

sshguard + service: init at 2.0.0 #23697

merged 1 commit into from Apr 30, 2017

Conversation

sargon
Copy link
Contributor

@sargon sargon commented Mar 10, 2017

Motivation for this change

sshguard has a smaller footprint than e.g. fail2ban and support blacklisting repeating attackers.

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

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

@@ -0,0 +1,41 @@
{ stdenv, fetchgit, autoreconfHook, yacc, flex, pkgs}:
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to pass the full pkgs to your derivation

homepage = https://sshguard.net;
license = stdenv.lib.licenses.bsd3;
maintainers = [ maintainers.sargon ];
platforms = stdenv.lib.platforms.all;
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to rewrite stdenv.lib for licence and platforms.
Also on platforms : you are explicitly building for iptables backend so it won't work on Darwin.

url = "https://bitbucket.org/sshguard/sshguard.git";
rev = "8600fd5b70cd80fad87c414fd7c410082991a209";
sha256 = "1i2ic8nca4f61pl2ggjp4x4an37hhvjgk2wv4smjsj6lvz3bw06a";
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why using fetchgit when you can get the stable release source from their SourceForge repo using fetchurl ?
https://sourceforge.net/projects/sshguard/files/sshguard/

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 10, 2017

Ah nice!
I also prefer sshguard over fail2ban since it doesn't need a full Python stack. It also supports IPv6, unlike f2b.

I've made some comments on your sshguard derivation mainly. The service module looks good.
You should also squash your 3 commits into one, please.

@sargon
Copy link
Contributor Author

sargon commented Mar 10, 2017

Thanks for the review, I fixed most of your suggestions, but struggling with the multi platform support.
When I have a nice solution for that, I can fix it all up into one patch.

@sargon sargon force-pushed the master branch 2 times, most recently from 2f05b7b to 05fd89c Compare March 11, 2017 12:59
@sargon
Copy link
Contributor Author

sargon commented Mar 11, 2017

Okay. I didn't see to get it right. So I reduced it to linux support and fix it all up into one patch. So someone with more experience in nix packages can pick it up. Or I will do it later when I got my mind around the builtins and stuff....

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 13, 2017

It's the safe course to target the package at Linux platforms only. It could still be enhanced for other platforms later on.

Now on your sshguard derivation : you started your package with 1.7.1 version in mind but you are now fetching the source of the newly released 2.0.0 :)

Either you stick to v1.7.1 and your fetching should be something like

src = fetchurl {
  url = "mirror://sourceforge/sshguard/sshguard-${version}.tar.gz";
  sha256 = "...";
}

... or you try to build the v2.0.0 [release note]

  1. you wouldn't need the configureFlags anymore because v2.0.0 "build and install all backend scripts by default"
  2. but v2.0.0 also "requires a configuration file to start" so it would force you to rework your service module

@sargon
Copy link
Contributor Author

sargon commented Mar 14, 2017

Okay. You are right. I picked the 2.0.0 in advance to your urlfetch suggestion, but to my shame I didn't study the release notes that intensive. I will further adopt your proposals. Should we, for the sake of the PR title, close this one and start a new one stating the version number?

@fpletz
Copy link
Member

fpletz commented Mar 14, 2017

We can change the title, no problem. Just force-push your changes.

The code looks also good to me apart from @c0bw3b's comments. If you're ready I can give this a spin and merge.

@sargon sargon force-pushed the master branch 2 times, most recently from 771813d to f5529f8 Compare March 22, 2017 22:36
@sargon sargon changed the title sshguard + service: init at 1.7.1 sshguard + service: init at 2.0.0 Mar 22, 2017
@sargon
Copy link
Contributor Author

sargon commented Mar 22, 2017

Okay, this should do the job.

@c0bw3b
Copy link
Contributor

c0bw3b commented Mar 23, 2017

Tested here with nox-review : it builds and runs fine.

@sargon
Copy link
Contributor Author

sargon commented Mar 24, 2017

@fpletz: I think you can give it a spin and merge, if you are satisfied with the changes.

@sargon
Copy link
Contributor Author

sargon commented Mar 26, 2017

Another fixup from my side.

Leaving creation of the ipsets to sshguards fw scripts seems no good idea. Sometimes the post startup actions gets started so fast, on some of my systems, that the first run of the sshguard firewall scripts hasn't happened. Hence the startup failed and systemd is immediately restarting the service. So we run into a classic timing problem here. So now the problematic system is starting the service correctly during boot. @fpletz merge?

@fpletz
Copy link
Member

fpletz commented Mar 28, 2017

@sargon You have pushed the wrong commit. This seems to be a module for nullmailer. :)

@sargon
Copy link
Contributor Author

sargon commented Mar 28, 2017

Narf. Must have happened this morning, just wanted to have that online. Fixed the branch, next time I should really not take the master branch for pull requests.

@sargon
Copy link
Contributor Author

sargon commented Apr 1, 2017

@fpletz may you have another look?

@7c6f434c 7c6f434c merged commit d5ec7bc into NixOS:master Apr 30, 2017
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