Monday, January 24, 2022

[FIXED] Composer self signed cert

Issue

Updated to the lastest release of composer. For years we have been hosting our package repository on http with no issues but now composer says it needs to connect over https. I can get round this by placing :-

    "secure-http": false

in my composer.json config statement. However I feel this is a bit of a work around and would like to get the https service connecting correcting. To achive this I've created a self signing certificate on the hosting server and enabled ssl. I can connect to the repository using my browser(with the usual exception message) but composer still refuses to connect to it.

My question is do I need to install a different certificate to get this to work?


Solution

Sort of pointed me in the right direction - I concatenated my certificate and key files into a pen file and then did:

"repositories": [
    {
        "type": "composer",
        "url": "https://packages.at.my.company.com",
        "options": {
            "ssl": {
                "verify_peer": true,
                "allow_self_signed": true,
                "local_cert": "/etc/apache2/ssl/packages.pem"
            }
        }
    }
],


Answered By - Graham Dodgson

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.