Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-2007, 10:52 AM
Active Member
 
Posts: 29
Default Preauth Failing (Invalid Timestamp)

I'm having an issue with preauth where I'm getting a message that the timestamp is incorrect. I'm using a PHP script to generate the values. The times on both servers are within a few seconds of each other and are in the same timezone. Also, zmprov gdpa gives me the same result as my script. Any thoughts? An example is below of what my script is returning for a URL:

Code:
http://zimbra.domain.com/service/preauth?account=user%40domain.com&by=name&timestamp=1177004153&expires=0&preauth=PAKSTRING
Reply With Quote
  #2 (permalink)  
Old 04-19-2007, 05:02 PM
Former Zimbran
 
Posts: 26
Default

Try multiplying the timestamp by 1000 (or concatenating '000' onto the end of it). The timestamp that PHP gives is in seconds, and the java preauth servlet is looking for a value in milliseconds, I believe. At least that is how I got it to work.

Mike
Reply With Quote
  #3 (permalink)  
Old 04-19-2007, 07:14 PM
Active Member
 
Posts: 29
Default

Great! Adding 000 to the end of the timestamp worked great. Now I have Zimbra integrated with our SSO solution. Thanks!
Reply With Quote
  #4 (permalink)  
Old 06-07-2007, 12:58 AM
Member
 
Posts: 10
Default

can you please post your php code
Reply With Quote
  #5 (permalink)  
Old 06-08-2007, 03:55 PM
Active Member
 
Posts: 29
Default

This is for making a PAK with the e-mail address. zimbraPAK contains the key generated by the gdpak command.

Code:
function getZimbraPAK($email) {
        // Returns query array with the PAK in it for an e-mail address
        global $zimbraPAK;

        $PAKTime = time()."000";
        $preauthString = $email."|name|0|".$PAKTime;
        $PAK = hash_hmac ("sha1",$preauthString,$zimbraPAK);

        $query = array(
                                                                "account" => $email,
                                                                "by" => "name",
                                                                "timestamp" => $PAKTime,
                                                                "expires" => "0",
                                                                "preauth" => $PAK);
        return $query;
}
Turn this into a URL with....

Code:
$zimbraPAK = "RANDOM_ZIMBRA_PAK";
$query = getZimbraPAK("user@domain.com");
$url = $zimbraHost."/service/preauth?".http_build_query($query);
I also use the following to get the mailbox node of the user...

Code:
function getZimbraHomeServer($email) {
        // Gets the users mailbox server
        $zimbraLDAP = ldap_connect("zimbra.domain.com");
        ldap_set_option($zimbraLDAP, LDAP_OPT_PROTOCOL_VERSION, 3);
        $zimbraLDAPR = ldap_bind($zimbraLDAP);

        // Query Zimbra Accounts
        $zimbraLDAPBase = "ou=people,dc=co,dc=marshall,dc=ia,dc=us";
        $zimbraSearchFilter="(zimbraMailDeliveryAddress=".$email.")";
        $zimbraSearchRes = ldap_search($zimbraLDAP,$zimbraLDAPBase,$zimbraSearchFilter);
        $zimbraSearchEntries = ldap_get_entries($zimbraLDAP,$zimbraSearchRes);

        return $zimbraSearchEntries[0]["zimbramailhost"][0];
}
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.