User Sync not working with secure sites (https)

Hi,
last week, I have enabled HTTPS on my commerce websites and since then, the sync has stopped to work for those sites, what should I do ?

Running version 1.1.5 of User Sync
Debug is activated but the folder "/plugins/user-sync/log" does not exist.

/Eric

  • Vaughan

    Hi Eric,

    Hope you're well?

    Can you try creating those folders manually?

    Also, if possible can you check your server Error logs to see if there's anything in those that might be related?

    Was it working fine till you changed to https?

    Can I ask what method you used to change to https? whether a plugin, or using htaccess for example.

    Could you grant support access from the dashboard plugin (on both the master & subsite) so we can take a closer look? See https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Thanks

  • Eric

    Hi Vaughan,
    1) I have granted you access to my Master and one of my site that used https
    2) Yes, it was working fine before I enable HTTPS
    3) I have created the "log" directory under "/plugins/user-sync"
    4) I have an extract of the server Error logs. (See attachment)
    5) For HTTPS, I have enabled this on my server (hosted with WPEngine.com) no plugins.

    I am ready to help to solve this issue.

    /Eric

  • Vaughan

    Hi Eric,

    Are you sure this actually worked?

    Ie-rime.com is a multisite & User Sync plugin has never ever been compatible with multisite, it was designed for single site installs only.

    I also note that lerime.com is not using https either, It will not work with sites that are mixed protocol. If 1 site is https, then they all have to be https, and vice versa.

    Hope this helps

  • Vaughan

    Hi,

    i'm almost 99% sure that is what the issue is because the master site is not SSL enabled, it tries to send the data via http, but the remote secondary sites are only accepting https.

    You will of course need to un-sync all the sites, and then go through and re-sync again with the new master site as https url.

    I asked a couple of other staff members who had SSL sites, and they confirm that it does work as long as both the master & the subsites are using the same https protocol.

    But as always that 1% could be something else. but i'm pretty certain that is the cause.

    I still don't know how it worked with multisite though, i've never known it to do that before, but as you say you had some changes done for user_roles and so on, which may have helped.

    Hope this helps

  • Eric

    Hi Vaughan,
    I will go and secure my other sites and we will see.

    This being said, I have upgraded to the latest version once I have started to see this issue so, I might have to downgrade to the version that was fixed by your team last year as I have no idea if those changed got ported to the new version or not.

    I will keep you posted on my progress.

    Thanks,
    /Eric

  • Vaughan

    Hi Eric,

    I'm going to have to ask one of our SLS guys for some assistance with this for you.
    But he will most likely require FTP access too.

    Can you send your details using the following contact form:

    https://premium.wpmudev.org/contact/#i-have-a-different-question

    Alternatively you can email direct to contact@wpmudev.org

    Mark for attn: Vaughan
    Include a ref URL to this thread.

    Please include the following details (provide details for all affected sites that you're wanting to connect);

    - Site login details (super-admin if on multisite)
    - FTP login details so I can take a look at the theme/plugin files.
    - CPanel Credentials so I can look at the DB with Phpmyadmin

    Thanks

  • Paul Kevin

    Hello Eric ,

    Hope you are well today. Sorry for the late response on this. Could you please try add this code in your active themes functions.php

    add_filter('user_sync_timeout', 'custom_user_sync_timeout');
    function custom_user_sync_timeout($timeout){
    return 60;
    }

    This should increase the sync timeout. By default SSL should not affect, but could you add this, if not already there, in your wp-config.php

    define('FORCE_SSL_ADMIN', true);
    just above the "/* That's all, stop editing! Happy blogging. */" line.
    After these changes, please test and let me know.

    Warm Regards
    Paul Kevin

  • Mahlamusa

    Hello Eric,

    I hope you are doing great today. I am sorry for the inconveniences you are having with our product and I hope we resolve them soon. I am very sorry for the delays from our side and I would like us to proceed further and resolve this as soon as we can.

    In an attempt to replicate this issue, I have setup the User Sync plugin in three website as follows:

    Master site: multi site main site (https://ms-example.com)
    Sub Sites: stand alone website (https://domain.com) and a sub site in the wordpress multisite (https://sub.ms-example.com)

    I was able to successfully sync users from the main site of the multi site to the stand alone site without issues. Then when I connected the sub site to sync from the main site in a multi site, I got user copied from the main site to the subsite but were suffixed with '_sync' which means if the username is admin then it becomes admin_sync. This happens if the option to not overrid existing users is selected, if I deselect all the options, then it does not sync or add users from the main site to the sub site. Maybe this is what is happening on your website.

    Each time I try, I get the following error: There was a connection problem. Please check the URL and Key of the Master site.

    This error seems to be caused by an invalid key. You should verify if you have copied or typed the correct key on your child site.You should copy the key from the master site to the sub sites.

    How can I help you to resolve this issue ? I can do whatever you want me to do as it is really important for me to fix that issue.

    I have looked at your website and noticed that the plugin is currently inactive and I didn't want to activate it and try to sync without your permission, so If you still need help with this, please activate the plugin or give us permission to do so and specify again which sites you want to sync.

    As I said above... this was working fine until someone form you team disconnected it during the investigation of the problem caused by SSL.

    We are very sorry to hear such an inconvenience and we do hope we get this working again as soon as possible. We really appreciate your patience as we work with you to resolve this.

    I hope you have a wonderful day and hope we resolve this as soon as possible. Have a nice day.

    Cheers,
    Mahlamusa

    • Eric

      Hi Mahlamusa,
      Thanks for your investigation so far but I am still blocked...

      When I try to make connection, between those two specific site I have, I always get the error "There was a connection problem. Please check the URL and Key of the Master site."
      I have no option selected and believe me, the key is OK and the URL is OK.
      I was able to connect my main site (https://le-rime.com/) to another site without any issues. This problem is just with a specific one (https://le-rime-bottin.com/)

      Those two were connected before and everything was working fine but when Vaughan has investigated the HTTPS issue, he has disconnected those two and since then, I am unable to re-connect those.

      This will definitely require more investigation to debug this issue as I agree with you, that used to work and as you have prove it, it is still working. So, there is something else which is preventing those two sites to re-connect. A database issue or something else... I do not know. Maybe there are some info in the Log file.

      By the way... the plugin is active... on the Main site only.

      How can I help more to help you investigate this and resolve this issue ?

  • Mahlamusa

    Hello Eric,

    I am sorry for the inconveniences you are having and I hope we resolve this as soon as possible.

    How can I help more to help you investigate this and resolve this issue ?

    First, please share access credentials via our secure contact form . In the contact form choose "I have a different question" then in write:

    Subject: "Attn: Lindeni Mahlalela"
    in the "Message" body, include:
    - Master Site WordPress login details: (login url, admin username, password)
    - Slave Site WordPress login details: (login url, admin username, password)
    - cPanel login details: (login url, username, password) OR FTP host, username and password if you do not have cPanel
    - Link back to this thread for reference

    I have noticed that you already sent these before but it seems they are for a test site and cPanel url does not work, so I ask that you share updated and working login details.

    If you have not enabled debug logging yet, please do so by editing the file 'wp-config.php' which sits in the root of your website, find the line:

    define('WP_DEBUG', false);

    and replace it with:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);

    Do this in both the Master and Slave sites you need help with. This will make sure WordPress writes any debug warnings and error messages on the file debug.log inside 'wp-content' folder. I will have a look at this file once logged in to your FTP/cPanel.

    This will be one step in the process, once I have this I will continue testing on your website and check the logs and see if there are any.

    Have a nice day.
    Mahlamusa

  • Mahlamusa

    Hello Eric.

    Thank you for sending in the login details, I have accessed your sites and tried to run some tests.

    The Slave site cannot connect to the master site as you have already said. I then tried to connect from one of my domains, it connected successfully without a single issue (I didn't sync users though, I disconnected after confirming the connection). This makes me think that the problem is within the le-rime-bottin website. To further test this I suggest you do a plugin conflict test on your Slave site by deactivating all plugins except User Synchronization.

    I have also enabled debug logging on both your websites to see if we can get anything useful from the debug messages. I have added the following lines of code in wp-config.php file:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);

    This will make WordPress write any error messages in the file 'wp-content/debug.log', this will help us further troubleshoot the issue.

    If you do have a tool like phpMyadmin, please share the login details the same way you shared the WordPress and FTP login details, this will help us inspect your database as well to see if there is anything that might be conflicting pieces of data in the slave site.

    Even though this is less likely, but if your slave site is failing to connect to the master site, then it may be blocked somehow either by a firewall, security plugin or some rules setup by your host. Only they can verify this. I say this because I was able to connect from one of my websites without issues but the slave domain you shared is having connection issues.

    I will will inspect the log files in a few hours to see if there is anything useful there. I will update here once I have found something.

    I hope this help, please let us know what you find from your side.

    Have a nice day.
    Mahlamusa

  • Mahlamusa

    Hello Eric,

    I hope you are doing great today. Thank you so much for your patience with regards to this. I logged into your website and checked log files for both the master and slave site, I also checked the settings linking the master and slave site and there is nothing there that could be a problem.

    I tried to forge the process by copying settings from a linked site to the slave site that is failing to connect, this too did not help. I then went to the code of user sync to try to understand its logic. The only thing that seems to be a realistic cause in the plugin is the fact that the plugin is using a process known as hashing to generate the keys and verify the connections when connecting sites to each other for synchronizing.

    Let me try to explain what I think happened:

    Before changing from http to https you had the urls: 'http://master.com' and 'http://slave.com', when connecting the slave to the master, the slave hashes its url along with a random string and sends the hashed value to the master. The master uses the same method to hash and compare the results, this is done to make sure that only authorized sites can link to sync data with the master site. If the hashed data is stored in the master site, changing any thing in the slave site will cause it to fail to connect because the hash sent will not match the verification hash on the master site.

    Say first, 'http://slave.com' was hashed, sent and stored on the master along, then later 'https://slave.com' was hashed and sent, then the hashed value cannot match because of the http/https difference in the URL. The results of a hash are always unique, so to get the data to match what is stored the very same data that was sent before must be sent again for the verification to be successful.

    So, if 'abcd.com' was hashed, then for this record to be verified, only 'abcd.com' must be sent to the verifier so that it can hash this value and compare the hash with the one stored, if a slightly different string was sent then the has will be completely different.

    If this is what actually happened, then the only thing to fix it is to delete the data on the master and all linked sites by using the Un-install feature. Once all the data has been removed, then the process can be started over so that a new key will be generated and all slave sites (including the one failing to connect) should then be able to connect using the new key.

    Please try that and let us know hoe it goes, we only hope it works. Please let us know if you have any further questions or concerns regarding this issue.

    Have a nice day.
    Mahlamusa

  • Mahlamusa

    Hello Eric,

    I am sorry for the delayed response from my side.

    This issue is a little bit hard so I asked one of my colleagues to help me resolve this. We will get back to you soon. We really appreciate your patience and all the feedback you are sharing with us.

    As we have already found that other sites are connecting fine to the master site, I think there might be a possibility that your sub site is blocked somehow to connect to the master site. Is there a possibility that you may try to find out from the host if there are any firewall/security rules that prevent the sites from communicating properly. I know this is a long short but is worth a try.

    I can't stress how sorry I am that this issue is still not resolved but we still need your patience and cooperation with regards to this issue.

    Have a nice day.
    Mahlamusa