Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 320199 - net-analyzer/fail2ban should depend on dev-python/pyinotify / app-admin/gamin
Summary: net-analyzer/fail2ban should depend on dev-python/pyinotify / app-admin/gamin
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
: 421277 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-17 14:14 UTC by Michael Kefeder
Modified: 2013-06-07 22:42 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dependent on libgamin with USE flag python (fail2ban-0.8.4-r1.ebuild,1.64 KB, text/plain)
2010-05-17 14:19 UTC, Michael Kefeder
Details
dependent on libgamin with USE flag python + app-admin/gamin (fail2ban-0.8.4-r1.ebuild,1.66 KB, text/plain)
2010-05-17 15:06 UTC, Michael Kefeder
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kefeder 2010-05-17 14:14:07 UTC
fail2ban automatically detects availability of gamin and uses it to listen for changes to logfiles. gamin uses the kernels inotify feature and is way more efficient than the default active polling algorithm fail2ban uses.

A already installed libgamin gets detected and used when fail2ban is installed by the current ebuild. So the only change needed to the ebuild: add dev-libs/libgamin to DEPEND for best performance, or at least create a custom USE flag to enable gamin support for informed fail2ban users.
Comment 1 Michael Kefeder 2010-05-17 14:19:56 UTC
Created attachment 231817 [details]
dependent on libgamin with USE flag python
Comment 2 Michael Kefeder 2010-05-17 15:01:36 UTC
apparently dev-libs/libgamin is not enough, it hast to depend on app-admin/gamin aswell, sorry for that.
Comment 3 Michael Kefeder 2010-05-17 15:03:57 UTC
Comment on attachment 231817 [details]
dependent on libgamin with USE flag python

app-admin/gamin dependency missing
Comment 4 Michael Kefeder 2010-05-17 15:06:32 UTC
Created attachment 231823 [details]
dependent on libgamin with USE flag python + app-admin/gamin
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2010-05-18 15:29:41 UTC
Quoting README:

Installation:
-------------

Required:
   >=python-2.3 (http://www.python.org)

Optional:
   >=gamin-0.0.21 (http://www.gnome.org/~veillard/gamin)
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-11 04:01:18 UTC
The old style virtual/fam does this quite well, not gamin alone.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-11 04:02:01 UTC
Comment on attachment 231823 [details]
dependent on libgamin with USE flag python + app-admin/gamin

Please attach patches against current ebuilds instead of complete ebuilds.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-11 04:19:05 UTC
(In reply to comment #6)
> The old style virtual/fam does this quite well, not gamin alone.

Hm, I was wrong. app-admin/fam doesn't itself install a python module.

BTW, you would want to DEPEND on app-admin/gamin if at all[1], because fail2ban wants to check local files so you need the server component as well. Maybe we should simply polish up jail.conf so it specifically points to <app-admin/gamin>.


[1] After all, you could emerge gamin yourself and set the runtime configuration accordingly, and we could tell users about that explicitly at install time or just let them figure it out while reading the configuration files.
Comment 9 Markos Chandras (RETIRED) gentoo-dev 2010-11-03 21:57:00 UTC
Any progress on that? I plan to release a new revision of fail2ban which fixes all the open bugs but I am not sure what to do with this one. I think depending on gamin makes sense
Comment 10 Xake 2011-01-11 10:19:41 UTC
why not reuse the classic USE="fam"?
Comment 11 john 2011-03-27 15:31:01 UTC
(In reply to comment #10)
> why not reuse the classic USE="fam"?

I concur, gamin has a lot of dependencies that not everyone wants, i think a gamin or fam USE would be better than adding a direct dependency on gamin.
my 2¢
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2012-06-18 23:17:39 UTC
*** Bug 421277 has been marked as a duplicate of this bug. ***
Comment 13 Michael Orlitzky gentoo-dev 2012-06-19 00:09:22 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > why not reuse the classic USE="fam"?
> 
> I concur, gamin has a lot of dependencies that not everyone wants, i think a
> gamin or fam USE would be better than adding a direct dependency on gamin.
> my 2¢

I was leaning towards a hard dependency, or at least a USE flag that's on by default. How many people who seriously want to use fail2ban would want to use it without gamin if they knew that it would wreck performance?

Instances of foot-shooting would likely outnumber the people who actually don't want gamin support.
 
On the other hand, glib does pull in more dependencies than I thought it did. The last empty VM I have sync'ed a year ago; I'll update it and see what gets pulled in on a fresh install.
Comment 14 Michael Orlitzky gentoo-dev 2012-06-20 20:54:59 UTC
Ok, after an update on a clean install, app-admin/gamin doesn't pull in anything except libgamin and gam-server. It does depend on glib (which pulls in some stuff), however, glib is already installed thanks to,

  * sys-fs/udev[extras]
  * sys-fs/udev[gudev]
  * dev-util/pkgconfig
  * x11-misc/shared-mime-info

An IUSE="+fam" with the conditional dep on libgamin[python] seems like the best way to go. That way, if someone really knows what they're doing (say, running on a kernel with no FAM support), they can prevent pulling in gamin.
Comment 15 Tom Hendrikx 2012-10-06 16:03:54 UTC
Note that the 0.8.7 release of fail2ban (currently ~arch) also has support for pyinotify, which depends only on dev-python/pyinotify. Upstream seemed really enthousiastic about replacing gamin/fam with this backend.
Comment 16 Jeroen Roovers (RETIRED) gentoo-dev 2013-06-06 16:29:40 UTC
It all depends on what you set instead of 'backend = auto' in jail.conf. Just emerging the backend you want should help you there. It neatly falls back to "polling" when pyinotify and gamin are missing.
Comment 17 Michael Orlitzky gentoo-dev 2013-06-06 19:00:09 UTC
(In reply to Jeroen Roovers from comment #16)
> It all depends on what you set instead of 'backend = auto' in jail.conf.
> Just emerging the backend you want should help you there. It neatly falls
> back to "polling" when pyinotify and gamin are missing.

But shouldn't they be controlled by use flags? I shouldn't have to do dependency management myself. PHP Packages don't, for example, make me manually emerge mysql if I want to use mysql as my database. There's a mysql USE flag to pull it in, and thus a permanent record in the package DB of why I need mysql installed.

The 'fam' USE flag already exists and would be perfect here. If the user doesn't pay close attention, he'll wind up with the polling default (even though he set backend=gamin!) which is terrible.

These days, fail2ban prefers pyinotify so I would depend on that instead of gamin, but I still think it should be controlled by a USE flag.
Comment 18 Jeroen Roovers (RETIRED) gentoo-dev 2013-06-07 14:40:53 UTC
(In reply to Michael Orlitzky from comment #17)
> But shouldn't they be controlled by use flags? I shouldn't have to do
> dependency management myself. PHP Packages don't, for example, make me
> manually emerge mysql if I want to use mysql as my database. There's a mysql
> USE flag to pull it in, and thus a permanent record in the package DB of why
> I need mysql installed.

No, when you install dev-lang/php with USE=mysql, you get a PHP module that handles doing MySQL stuff, which means it builds and links against a library installed by dev-db/mysql. 

An ebuild should not control runtime dependencies through USE flags when the installed contents of the ebuild itself does not change. Setting up the runtime configuration is equally a bad idea.

Back to the present case, fail2ban runs absolutely fine without gamin or pyinotify.
And again, controlling merely useful as opposed to necessary runtime dependencies through USE flags is not the way to go.

Worse yet, if you use sasl-iptables as backend in jail.conf, then neither gamin nor pyinotify is used because that sets "backend = polling"!

If you want, we can add some informative elog messages that are printed when (in order) pyinotify and gamin are not installed, to suggest that either of those could be beneficial. Would that be a solution? Something like:

Index: fail2ban-0.8.9.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/net-analyzer/fail2ban/fail2ban-0.8.9.ebuild,v
retrieving revision 1.4
diff -u -B -r1.4 fail2ban-0.8.9.ebuild
--- fail2ban-0.8.9.ebuild       6 Jun 2013 17:20:14 -0000       1.4
+++ fail2ban-0.8.9.ebuild       7 Jun 2013 14:40:41 -0000
@@ -68,4 +68,10 @@
                elog "You are upgrading from version 0.6.x, please see:"
                elog "http://www.fail2ban.org/wiki/index.php/HOWTO_Upgrade_from_0.6_to_0.8"
        fi
+       if ! has_version ${CATEGORY}/${PN} && \
+               ! has_version dev-python/pyinotify && ! has_version app-admin/gamin; then
+               elog "For most jail.conf configurations, it is recommended you install either"
+               elog "dev-python/pyinotify or app-admin/gamin (in order of preference)"
+               elog "to control how log file modifications are detected"
+       fi
 }
Comment 19 Markos Chandras (RETIRED) gentoo-dev 2013-06-07 14:46:03 UTC
that looks good to me
Comment 20 Jeroen Roovers (RETIRED) gentoo-dev 2013-06-07 14:49:55 UTC
(In reply to Markos Chandras from comment #19)
> that looks good to me

I already committed it, too. :)
Comment 21 Michael Orlitzky gentoo-dev 2013-06-07 22:42:55 UTC
(In reply to Jeroen Roovers from comment #18)
> 
> No, when you install dev-lang/php with USE=mysql, you get a PHP module that
> handles doing MySQL stuff, which means it builds and links against a library
> installed by dev-db/mysql. 
> 
> An ebuild should not control runtime dependencies through USE flags when the
> installed contents of the ebuild itself does not change. Setting up the
> runtime configuration is equally a bad idea.
> 

Sorry, I should have been more clear. I meant various PHP apps, like mail-client/roundcube and www-apps/drupal which optionally support both mysql and postgres via a config file.

There are a /lot/ of packages that do e.g.,

RDEPEND="mysql? ( dev-lang/php[mysql] )"

thereby pulling in mysql, even though it's only a config-controlled runtime dependency. Basically every application supporting more than one database works this way.

I won't press the issue though, no need to waste time arguing.