saslpasswd for batch adds
Jonathan Marsden
jonathan at bach.xc.org
Tue Jul 1 18:59:59 EDT 2003
Joe,
On 1 Jul 2003, joe ritter writes:
> However I am noticing that there is no documentation on adding all
> these Cyrus users to the sasldb2. What is the best way to handle
> this with more than a few thousand users. I looked at the man page
> for saslpasswd2 and it wasn't clear if it was capable of taking
> input from a tab delimited user/password file. We are using auxprop
> by the way. If anyone can share their experience or suggestions
> with this I would greatly appreciate it.
AFAIK, saslpasswd2 can't use a tab-delimited username/pw file
directly. However, it is designed for non-interactive use where the
password is piped in on STDIN and the username is passed as a command
line parameter. Something like:
echo "PASSWORD" |saslpasswd2 -p -c username
So, given a tab delimited username/password file, a quick line of Perl
something like
(perl -p -e "s/^([^\t]+)\t(.*)$/echo '\2' |saslpasswd2 -p -c \1/" <passwordlist) |sh
would let you exec saslpasswd2 once per user (note, the above one
liner probably breaks for passwords containing the single quote
character). How long this would take for many thousands of users is
not something I have any experience with, and the above is not exactly
an optimized approach. It works for me for a few hundred users.
If your auxprop does something interesting, it may be faster to bypass
saslpasswd2 and create the database entries more directly?
Jonathan
--
Jonathan Marsden | Internet: jonathan at xc.org | Making electronic
1252 Judson Street | Phone: +1 (909) 795-3877 | communications work
Redlands, CA 92374 | Fax: +1 (909) 795-0327 | reliably for Christian
USA | http://www.xc.org/jonathan | missions worldwide
More information about the Info-cyrus
mailing list