Closed jdavidzapatab closed 4 years ago
I used this guide to create crt and key. https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
Then I merged them into joined.pem ( cat apache.crt apache.key > joined.pem ) location of crt, key and joined.pem "/etc/apache2/ssl/".
Then in php:
$pemFile = '/etc/apache2/ssl/joined.pem';
$pemPassphrase = 'The one I used to create cert';
//Although apache restart will not ask for pass anymore with this cert, i decided to pass cert anyway as this was on wss
Moreover, I went to my new https://site.com and add cert to acception as it was self signed. I also went to https://site.com:8000/ and add cert to acception as well (make sure your wss server is running). After that, i went back to https://site.com and wss connected fine.
I still have some issues as I upgraded Wrench from older version, but with new install there should be no problem.
Using:
wrench/wrench, version v2.0.7, via Composer.
I've been testing for a while the creation of a Secure Websocket server. I have tested that from my website with no problems, it uses a valid certificate. But a friend of mine is trying to do the same with his valid certificate with no good results.
I helped him to create the secure websocket with Wrench, the PEM certificate was correctly created and the php script has the correct path.
When I start the php script it does not report any problem, it just says the server was initialized. But when the first connection from the browser arrives, it fails with this error message:
The certificate PEM file is in the correct path:
That PEM file was created with:
The Key file has no Passphrase.
Here is the secure_server.php content:
For better compatibility, we created a simple apache with SSL on the same machine, and we changed the default index.html to have a very simple echo websocket client connecting to this server. Of course, we added SSL support by using the very same certificate (crt, key, ca_bundle).
I tried all of this with my domain and certificate and it works correctly.
Both certificates were issued by the same company and both are of the same type/class, generated only with a few days of difference.
Is there anything wrong with the secure_server.php script, or perhaps there is any kind of problem with PHP socket functions and how it handles certain certificates?
My webpage with the echo test working is here: [https://jdzb.org/servicios/testwebsockets]. This one works fine.
To test the failing service, right now it is not pointed by the domain, but please add to your host file ("/etc/hosts" in linux, "C:\Windows\System32\drivers\etc\hosts" in windows) the following:
Then access [https://ecompound.net] to test it, although tis page will only display "DISCONNECTED {} Error undefined". The browser console shows:
Any help is highly appreciated.
UPDATE 01
We have some other ssl certificates available, and we have tested some of those with success, but if we try to connect to the same page from an iPad, somehow it fails, as if there were incompatibility issues between the iPad and the secure websocket server with certain certificates. Again, for this case from an iPad the echo test in my site [https://jdzb.org/servicios/testwebsockets] works correctly, but it has failed from other ssl certificates that are considered valid by all mayor PC web browsers.