Change Password....

"J.C.P.D. Jessy Leeuwenhage" <[email protected]>
Newsgroups gmane.mail.neomail.general
Message-ID <[email protected]>
Aloha !!!

Regarding the last mail/question I send. I think I have a nice solution..

First Here is the question again :

> Aloha !!!
> 
> I have changed my .pl files in order to allow a user to change his
> password. I did it via :
> 
> http://xux.mirc.com.mx/neomail/neopass.txt
> 
> So far, everything works. I put it on paranoid mode and it check my
> pasword etc. etc. but it doesn't REALLY change my password ??? 
> I don't get it, everything seems to be in order. 
> 
> I got some typo's like : field in stead of fiedl
> or : my $cpass = param("cpass");  # Used to be param("cpass1") 
> 
> I have Neomail running as root (I can see with ps -aux)
> 
> I really dont get it anymore ???
> 
> 
> Greets from your desperate Neoail User...
> 
> 
> 
> Jessy

The solution is very simple and.... doesn't need to be a security hazard
like running apache/neomail as root, sudo's and what more some people
suggested to me...

I just let the neomail-prefs.pl put the username with the encrypted
password put in a file :

   $pass1 = crypt($pass1, $realsalt);
   open (CHPASS,"| $chpasswdcmd -e") or 
      neomailerror("$lang_err{'passcmdnotfound'}");
#      print CHPASS "$user:$pass1\n";
      open (fileOUT, ">>/home/www/webmail/htdocs/passwd-file.txt");
         print fileOUT "$user:$pass1\n";
      close (fileOUT);
      writelog("PWD-Change - $thissession");
   close (CHPASS);
      }

I also let it write a note in the log that the user with session bla bla
changed his/her password.

The line :
#      print CHPASS "$user:$pass1\n";
I left in just in case I ever wanna do something else in the future..

Ok once it is in a file you only need a small shell script :

mymachine bin # cat change-neomail-pwd 
#!/bin/bash
#
# This  file changes the by neomail-supplied users and there passwords.
#
# It is being called bij root-crontab every 5 minutes.
#
#

if test -s /home/www/webmail/htdocs/passwd-file.txt
        then
           # Change Passwd
           #
           /usr/sbin/chpasswd -e < /home/www/webmail/htdocs/passwd-file.txt

           # Make new file for new pasword changes
           #
           rm        /home/www/webmail/htdocs/passwd-file.txt
           touch     /home/www/webmail/htdocs/passwd-file.txt

           # make sure Neomail can write in the file
           #
           chmod 666 /home/www/webmail/htdocs/passwd-file.txt
        fi
mymachine bin #

And (like it said in the remarks) a small crontab entry :

#
# Cange the Neomail-given user-paswords.
#
# Will be executed every 5 minutes
#
0,5,10,15,20,25,30,35,40,45,50,55   *   *   *   *       cd
/usr/local/bin ; ./change-neomail-pwd

VOILA !!! Everything works....
The only thing you have to put in your preference-screen is a warning
that it can take up to 5 mins for a password-change to work...


Greetings to everybody and thank you for the overwhelming replies I had !!!

Jessy


-- 
Send With Wabbit-Wion-Webmail



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.