[sork] sasldb2 password change

Kinglok, Fong busywater at gmail.com
Thu Mar 8 00:24:06 UTC 2012


On Thu, Mar 8, 2012 at 7:54 AM, Tilman Schmidt <t.schmidt at phoenixsoftware.de
> wrote:

> Am 07.03.2012 19:06, schrieb Ralf Lang:
> > Am 07.03.2012 17:59, schrieb Tilman Schmidt:
> >>   passwords", but none of these seems to fit the
> >> bill. The most promising candidate, "expect", seems to require that
> >> mail users can also login via telnet or ssh.
> >
> > Does your cyrus support changing the imap password? See imp/backends.php
> > for documentation.
>
> Cyrus SASL does of course support changing SASLdb passwords,
> which I use for the IMAP service, via the saslpasswd2 command.
> That's how I set passwords now. But that requires logging in
> with a shell, which is exactly what my mail users cannot do.
>
> There is no file imp/backends.php in my Horde installation.
> The file imp/config/backends.php exists but doesn't contain
> anything related to password change as far as I can see.
>
> T.
>
>
> --
> Sork mailing list - Join the hunt: http://horde.org/bounties/#sork
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sork-unsubscribe at lists.horde.org
>
>

Hi, you can consider using expect script for changing password.  For sure,
it is only for vpopmail.

Here comes my backends.php in passwd:

$backends['expect'] = array (

                'name' => 'Webmail Password',

                'preferred' => '',

                'password policy' => array(

                                'minLength' => 3,

                                'maxLength' => 8,

                                'maxSpace' => 0,

                                'minUpper' => 0,

                                'minLower' => 0,

                                'minNumeric' => 0

                ),

                'driver' => 'expect',

                'params' => array(

                                'program' => '*/usr/bin/expect'*,

                                'script' => dirname(__FILE__) .
'/../scripts/*vpopmail_cdb_expect'*,

                                ),

                ),


My vpopmail_cdb_expect is as follows:

# $Horde: passwd/scripts/vpopmail_cdb_expect,v 1.6 2005/04/20 05:51:17
selsky Exp $

#


# read input from stdin

fconfigure stdin -blocking 1

gets stdin user

gets stdin password_old

gets stdin password_new


log_user 0

set timeout 1

set log_file "/tmp/log-horde"


# read in other option

for {set i 0} {$i<$argc} {incr i} {

    set arg [lindex $argv $i]

    switch -- $arg "-log" {

        incr i

        set log_file [lindex $argv $i]

        continue

    }

}


set err [open $log_file "w" "0600"]


set pid [spawn /home/vpopmail/bin/vchangepw]

expect {

  -re "Please enter.*" { send $user\r }

  timeout {puts $err "Cannot start vchangepw program.\n"

                 close $err

                 exit 1}

}


expect {

  $user { puts $err ""}

  timeout {puts $err "Cannot continue 1 vchangepw program.\n"

                 close $err

                 exit 1}

}

expect {

  -re "Enter old password.*" { send $password_old\r }

  timeout {puts $err "Cannot continue 2 vchangepw program.\n"

                 close $err

                 exit 1}

}

expect {

  -re "Please enter password.*" { send $password_new\r }

  -re "Error:.*"   {

                 puts $err "Wrong password.\n"

                 close $err

                 exit 1}

  timeout {puts $err "Cannot continue 3 vchangepw program.\n"

                 close err

                 exit 1}

}


expect {

  -re "enter password again.*"   { send $password_new\r }

  timeout {puts $err "Cannot continue 4 vchangepw program.\n"

                 close $err

                 exit 1}

}


expect {

  -re "Password successfully.*"   { }

  timeout {puts $err "Cannot continue 5 vchangepw program.\n"

                 close $err

                 exit 1}

}

puts $err "The password changed successfully."

expect {

   eof { close $err

          exit 0 }

}


exit 0


More information about the sork mailing list