[Exim] SMTP authentication with public-key (PGP/GPG)?

Top Page
Delete this message
Reply to this message
Author: Daniel Dorau
Date:  
To: exim-users
Subject: [Exim] SMTP authentication with public-key (PGP/GPG)?
Hello,
I'm looking for a secure way to do SMTP authentication. There are
two things I would like to have taken care of:

- passwords are not transmitted plain text and sniffing them should
not allow others to re-use them => challenge/response needed
- passwords should not be stored in plain text on the mail server
(as with cram-md5)

I thought, one could do an authentication with asymetric cryptography.
The idea I have works as follows:

The server generates a challenge string. The client takes this
string and adds his username to this string (challenge\nusername)
and signs this resulting string with his private (PGP/GPG or
whatever) key. The result is sent back to the server which uses
the username to lookup the public key from that user and checks
the signature. Note that the server does not need to know his own
challenge when checking the signature. The challenge is only
needed to have the client generate a different signature each time,
so sniffing it won't help.

Now my question: Is it possible to 'hack' this into exim using PAM?
(of course one would have to write a special PAM module)

maybe using the plaintext driver with 'LOGIN' like this:

        server                                   client


challenge = "${pam{challenge}}"
server_prompts = "$challenge name:signature"
server_condition = "${if pam{check:$1:$2}{1}{0}}"

          <---------------------------------------- send "AUTH LOGIN"


          ----------------------------------------> store challenge
                     "$challenge name:"


          <-----------------------------------------
                      send user name


          ------------------------------------------> sign "$challenge\n
                       "signature:"                   username" with 
                                                      private key


          <-----------------------------------------
               send signed "$challenge\nusername"


lookup users
public key and
check signature


Maybe it is sufficient to only sign the challenge and send back the
signed challenge as "signature:" response.

I hope you got the idea now. The pam module called with "challenge"
generates a challenge string.
When called with "check" it looks up the public key and checks the
signature.

Do you think this is possible using the plaintext(LOGIN) driver?
(In using the LOGIN method, I see the only way to transmit the
challenge string to the client)

What do you think about it?

-- 
Daniel Dorau                                      woodst@??? 
<< Linux is like living in a tipi: No windows, no gates, Apache inside >>
       PGP key available, send mail with 'Subject: send pgp key' 
            fingerprint: 8D7E0B2F9E2E5338  DB7B24742E8B2EAE