Help with Openfire.xml

Hello all;

I hope you are able to help me. I have tried to setup my OpenFire to authenticate with my WordPress+BuddyPress user database. Every time I try to upload the script it gives me a password fail error when I try and login. Is there a fault in this code somewhere that I’m not seeing? I changed the name of my MySQL database, username, and password but other than that this is the code I am using:

Thanks in advance!

<?xml version="1.0" encoding="UTF-8"?> <jive>   <adminConsole>     <port>9090</port>      <securePort>9091</securePort>   </adminConsole>    <admin>
    <authorizedUsernames>skyrie</authorizedUsernames>
  </admin>
  <network>
    <interface>xxx</interface>
  </network>
  <locale>en</locale>    <connectionProvider>     <className>org.jivesoftware.database.DefaultConnectionProvider</className>   </connectionProvider>    <database>     <defaultProvider>       <driver>com.mysql.jdbc.Driver</driver>        <serverURL>jdbc:mysql://localhost:3306/xxx</serverURL>        <username>xxx</username>        <password>xxx</password>        <testSQL>select 1</testSQL>        <testBeforeUse>true</testBeforeUse>        <testAfterUse>true</testAfterUse>        <minConnections>5</minConnections>        <maxConnections>25</maxConnections>        <connectionTimeout>1.0</connectionTimeout>     </defaultProvider>     <jdbcProvider>
      <driver>com.mysql.jdbc.Driver</driver>
      <connectionString>jdbc:mysql://localhost/xxx?user=xxx&amp;password=xxx</connectionString>
    </jdbcProvider>
    <provider>
      <auth>
        <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className>
      </auth>
      <user>
        <className>org.jivesoftware.openfire.user.JDBCUserProvider</className>
      </user>
    </provider>
    <jdbcAuthProvider>
       <passwordSQL>SELECT user_pass FROM wp_users WHERE user_login=?</passwordSQL>
       <passwordType>md5</passwordType>
    </jdbcAuthProvider>
    <jdbcUserProvider>
      <loadUserSQL>SELECT user_nicename,user_email FROM wp_users WHERE user_login=?</loadUserSQL>
      <userCountSQL>SELECT COUNT(*) FROM wp_users</userCountSQL>
      <allUsersSQL>SELECT user_login FROM wp_users</allUsersSQL>
      <searchSQL>SELECT user_login FROM wp_users WHERE</searchSQL>
      <usernameField>user_login</usernameField>
      <nameField>user_nicename</nameField>
      <emailField>user_email</emailField>
    </jdbcUserProvider>
  </database>  <setup>true</setup>
</jive>

Wordpress does not store passwords in MD5 required by Openfire.

Replace your password function in WordPress with this

function wp_hash_password($password) {
global $wp_hasher;
if ( empty($wp_hasher) ) {
  require_once( ABSPATH . 'wp-includes/class-phpass.php');
  // By default, use the portable hash from phpass
  $wp_hasher = new PasswordHash(8, TRUE);
}
//return $wp_hasher->HashPassword($password);
return md5($password);
}
endif;
1 Like

Is that why I get “org.jivesoftware.openfire.net.SASLAuthentication - User Login Failed. PLAIN authentication failed” in my logs when I try to login? It’s still reading plain, even though I set it to MD5.

Is your solution safe to use on a large commercial website?

If you are using SSL, I don’t see why not

I changed my WP pluggable.php file to match yours, but it didn’t work. I’m still getting this error.

Seriously, this is getting rediculous now.I’ve been trying to configure OpenFire for two months and still have got nowhere.

I’m willing to pay anyone who can fix my script a modest fee.

Of course it wont work.

Your password is still encrypted in WordPress hashing method. You need to go to WordPress and re-enter the password inorder to create a compatible MD5 version for Openfire

I’ve done that already. I’ve modified ofproperties, I’ve modified openfire.xml. Nothing works. I keep getting username/password errors.

Holy crap. I have been trying to get my stuff working for 2 weeks now.

Thank you SOO much.That was the missing piece.

to which wordpress config file shall we make the edition you have presented ?

i suppose the edit have to be done there

wp-includes/pluggable.php

Function Reference/wp hash password « WordPress Codex