Bug 5205 - spamd ldap configuration with same time virtual-config-dir usage
Summary: spamd ldap configuration with same time virtual-config-dir usage
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: 3.1.7
Hardware: All other
: P5 enhancement
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-23 22:08 UTC by braun
Modified: 2019-09-25 03:25 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description braun 2006-11-23 22:08:18 UTC
The idea of having the config in a ldap server, so that users can change their
config, without a local server account is great. But running spamd with none
local users, which still have their individual bayes databases but config in a
ldap server does not work, as the two options ldap-config and virtual-config-dir
are exclusive. So what would be great, is, that having the config in the ldap,
but still be able to use virtual-config-dir as data storage for the baayes and
auto-whitelist databases would be even better. 
I changed the code of spamd a little bit, so that exactly that works. So that I
can use the following command line options:
--virtual-config-dir="/spamassassin/users/%u" -x 
and configure the user_scores_dsn, user_scores_ldap_username,
user_scores_ldap_password entries in local.conf.

With the followinf small patch the following happens. If there is no user_prefs
file in the virtual config dir, it tries to find one in the ldap server.
But compared to the plian ldap-config option, if the config e.g. enables bayes
filtering, if still saved the users individual databses in the
virtual-config-dir. So I can have config in ldap but still individual users
databases. Best of two worlds so to say.

The small patch is, which works for me is:

*** spamd       Mon Nov 20 01:41:05 2006
--- /usr/perl/bin/spamd Wed Nov 22 04:37:19 2006
***************
*** 1818,1832 ****
      $userdir   = $dir;
      $prefsfile = $dir . '/user_prefs';
  
-     # Log that the default configuration is being used for a user.
-     info("spamd: using default config for $username: $prefsfile");
    }
  
    if ( -f $prefsfile ) {
! 
      # Found a config, load it.
      $spamtest->read_scoreonly_config($prefsfile);
    }
  
    # assume that $userdir will be a writable directory we can
    # use for Bayes dbs etc.
--- 1821,1838 ----
      $userdir   = $dir;
      $prefsfile = $dir . '/user_prefs';
  
    }
  
    if ( -f $prefsfile ) {
!     # Log that the default configuration is being used for a user.
!     info("spamd: using default config for $username: $prefsfile");
      # Found a config, load it.
      $spamtest->read_scoreonly_config($prefsfile);
    }
+   else {
+     info("ldap: entering handle_user_ldap($username)");
+     $spamtest->load_scoreonly_ldap($username);
+   }
  
    # assume that $userdir will be a writable directory we can
    # use for Bayes dbs etc.