On Thu, Jan 05, 2017 at 12:47:07PM +1030, Ron wrote: > On Thu, Jan 05, 2017 at 08:34:04AM +1100, martin f krafft wrote: > > also sprach Johannes Berg <johan...@sipsolutions.net> [2017-01-05 01:11 > > +1100]: > > > I'm not even sure how to get the username? Is it even generally > > > possible, if e.g. the plugin is running out of a process that's not > > > invoked through the imapd? > > > > Well, the plugin certainly does seem to be run as the target user, > > or else how could it be used for user-specific training? > > There's probably a lot of things we _could_ do ... > > In the most general case getpwuid_r(geteuid(),...) should tell us who we > are running as, no matter how we are run - but that has potential icky, > since getting that name could involve a network access to LDAP or worse. > > I'm not sure offhand if dovecot already (reliably) exposes it to us in > the environment we get from it - docs on that didn't pop out at me ... > > Or worst case, we could make one, and let people do something like: > > antispam_log_prefix = %u > > in their config, since dovecot will expand the %u for us ... > That has the advantage of letting them customise it if they have some > really crazy setup with multiple dovecot instances all logging to the > same place ... > > > But all of this kind of sets my XY problem overkill alarm off in a > variety of ways, so I think we ought to actually start at the top: > > Martin, what _actual_ problem did you have to make you want this? > That might be something we can (also?) fix better and simpler?
Just to be clear, there's a lot of permutations here about what backend might be run (and you didn't say which you are using), and usually the only case where the user might actually matter, we're passing that user to an external program (and don't have any control over what it outputs) ... So in most of what -antispam might log, any failure isn't going to be due to something "user specific" - which means it would be good to know exactly what problem you hit that (you thought?) was. Otherwise, this could just turn into lots of intrusive busywork that doesn't actually solve it, if we don't know what "it" was. Ron