• I’m so glad y’all had the thread you did here and here because it got me close to the answer! My client had the exact same issue with their WordPress site hosted on Azure App Service and using the Azure Database for MySQL flexible server. When trying to login, the first error would be:

    Connections using insecure transport are prohibited while –require_secure_transport=ON

    And then would get stuck in an infitinite loop, eventually stopping when a new error would lock me out for 30 minutes for too many failed attempts.

    Unfortunately, overriding the class in a must-use plugin as you suggeted didn’t work, mainly because your PEXLECHRIS_ADMINER_DIR constant is not defined yet since must-use plugins are executed before other plugins, causing a fatal error.

    In the end, I added the function to your class with a filter like this:

    File: /wp-content/plugins/pexlechris-adminer/inc/class-pexlechris-adminer.php inserted at line 20

    function connectSsl() {
    $conn = apply_filters('pexlechris_adminer_connectssl', array());
    if (is_array($conn)) return $conn;

    return array();
    }

    And then in my environment, I downloaded the DigiCertGlobalRootCA.crt.pem file (from here) and placed it in the html directory next to the directory where I have my WordPress installation and then added this code to my must-use plugin:

    function au_adminer_connection_ssl($conn)
    {
    // Go up to the parent directory "www" and into the "html" directory
    $adminer_crt = dirname(ABSPATH, 1) . '/html/DigiCertGlobalRootCA.crt.pem';
    if (file_exists($adminer_crt)) {
    $conn['ca'] = $adminer_crt;
    }
    return $conn;
    }
    add_filter('pexlechris_adminer_connectssl', 'au_adminer_connection_ssl');

    With that, your plugin worked like a charm! I’d be grateful if you could include the connectSsl() function and filter in a future plugin update. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Pexle Chris

    (@pexlechris)

    Yes, a filter it would be a great idea. Thanks!

    Plugin Author Pexle Chris

    (@pexlechris)

    Unfortunately, overriding the class in a must-use plugin as you suggeted didn’t work, mainly because your PEXLECHRIS_ADMINER_DIR constant is not defined yet since must-use plugins are executed before other plugins, causing a fatal error.

    This should work! In my end works and I don’t know why this solution not works on your end.

    If you add this function WITHOUT ANY OTHER CONTENTS in a must-use plugin:

    	function adminer_object()
    {

    include_once PEXLECHRIS_ADMINER_DIR . '/inc/class-pexlechris-adminer.php';

    class My_Custom_Adminer_Class extends Pexlechris_Adminer
    {
    function connectSsl()
    {
    return [
    'key' => 'filename', // you maybe change or delete this row
    'cert' => 'filename', // you maybe change or delete this row
    'ca' => '/var/www/html/DigiCertGlobalRootCA.crt.pem', // Certificate can be downloaded here: https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem
    ];
    }
    }

    return new My_Custom_Adminer_Class();

    }

    override should work, because this function is called in file
    wp-content/plugins/pexlechris-adminer/inc/adminer.php which is called in file
    wp-content/plugins/pexlechris-adminer/inc/adminer_includer.php and this file is called in
    function determine_if_pexlechris_adminer_will_be_included() which this function is called in action plugins_loaded which is called when all plugins have been loaded and all the plugins’ constants. So constant PEXLECHRIS_ADMINER_DIR should not been undefined!

    In my end, when I add a mu-plugin wth this function, WP Adminer cannot login anymore with the DB Credentials. So the override is working!

    Because of these, there is no reason to alter WP Adminer code, but I can help you with debugging.

    So, please tell me which is the path of your mu-plugin and its contents that you try to install?

    Plugin Author Pexle Chris

    (@pexlechris)

    Because of these, there is no reason to alter WP Adminer code, but I can help you with debugging.

    So, please tell me which is the path of your mu-plugin and its contents that you try to install?

    Thread Starter Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Sorry for being unresponsive. I’ll mark this as resolved. I personally prefer using filters and actions to extend functionality, that way even the required plugin was uninstalled or inactive, the code doesn’t cause errors. Creating a must-use plugin, prematurely including files, and extending an entire class feels a bit overkill to me for a small feature, so I’ll stick to the filter method. If you don’t want to update the plugin, that’s fine. I’ll put it in my dev notes for when I update this client’s site if you put out new releases 🙂

    Thank you and have a lovely day!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Doesn’t work while –require_secure_transport=ON’ is closed to new replies.