crypt() password encoding

crypt() password encoding

by Rein Laaneser -
Number of replies: 4

Have someone tried crypt() password encoding for user authentication? This is usually the case  in linux /etc/passwd /etc/shadow authentication ?

I would like to syncronize all my 200 students usenames and passwords from school server to Moodle

Rein Laaneser

Average of ratings: -
In reply to Rein Laaneser

Re: crypt() password encoding

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I have some unfinished code sitting here for a PAM authentication module which will allow Moodle to authenticate directly against a Unix (eg Linux) server via PAM.
In reply to Martin Dougiamas

Re: crypt() password encoding

by Rein Laaneser -

Thank you. This sounds good. But lets say the case is that I have different servers for school domain and web server. Whith my webserver ISP I cannot authenticate against outside servers.

I would like then use file like /etc/shadow or separate MySQL table for this.

What then. Plugin? Pesonally I do not know yet the PHP... Just started to do first steps.

Sincerely,

In reply to Rein Laaneser

Re: crypt() password encoding

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Making a separate database table is the easiest way to go, then use the existing "database authentication", with a slight modification to crypt the passwords before checking them.

You could script something to dump /etc/passwd into the database, or just do it manually.
In reply to Martin Dougiamas

Re: crypt() password encoding

by Rein Laaneser -
Is the modification then something like....
    if ( md5('typed_password')  = 'hased_password' {
        true;
    }
to change to something like....
    if ( crypt('typed_password', 'hased_password') = 'hased_password' {
        true;
    }

-ReinL: