metaregistrar / php-epp-client

Object-oriented PHP EPP Client
https://www.metaregistrar.com/docs/
MIT License
210 stars 155 forks source link

EPP Connection problem #166

Closed pfirtelu closed 5 years ago

pfirtelu commented 5 years ago

Hi there, I'm trying to use this client for an EPP connection, with PHP 7.2, OpenSSL 1.1.1, Curl 7.62.0. When using openssl, I can see EPP greeting (Host, Port and other Info removed "[...]"): openssl s_client -4 -connect HOST:PORT

CONNECTED(00000005)
depth=1 C = BM, O = [...], CN = [...]
verify error:num=20:unable to get local issuer certificate
---
Certificate chain
[...]
---
Server certificate
-----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
[...]
?<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><greeting><svID>XXXXXXXXX</svID><svDate>2018-11-06T15:38:10+01:00</svDate><svcMenu><version>1.0</version><lang>en</lang><objURI>urn:ietf:params:xml:ns:contact-1.0</objURI><objURI>urn:ietf:params:xml:ns:domain-1.0</objURI><objURI>urn:ietf:params:xml:ns:host-1.0</objURI><svcExtension><extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI><extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI><extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI></svcExtension></svcMenu><dcp><access><personalAndOther /></access><statement><purpose><admin /><other /><prov /></purpose><recipient><ours /><public /></recipient><retention><legal /></retention></statement></dcp></greeting></epp>

Without forcing IPv4 (Parameter "-4"), it returns only this:

CONNECTED(00000005)
write:errno=0
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 320 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)

Now, when trying to make a connection with the PHP EPP client with these parameters: $conn = new eppConnection(); $conn->setHostname('ssl://HOST'); $conn->setPort(PORT); I'm stuck with this error: _Warning: stream_socket_client(): SSL: Success in [...]/eppConnection.php on line 393 Warning: stream_socket_client(): Failed to enable crypto in [...]/eppConnection.php on line 393 Warning: stream_socketclient(): unable to connect to ssl://HOST:PORT (Unknown error) in[...]/eppConnection.php on line 393 (google research does not turn up much useful stuff about it)

When trying to make a connection with these parameters: $conn = new eppHttpsConnection(TRUE); $conn->setHostname('HOST:PORT'); // without the ssl:// I get: _ERROR: Error occurred while executing CURL 35: OpenSSL SSL_connect: SSL_ERRORSYSCALL in connection to HOST:PORT Now I thought this is a problem with IPv6 (since I had to force IPv4 with OpenSSL). When using the eppHttpsConnection and adding the following to the initcurl function: curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); I get this error: ERROR reading EPP message: Document is empty in Entity, line: 1

Now I'm a bit confused which is the right direction. An help is appreciated!

pfirtelu commented 5 years ago

Now I managed to solve the problem by using tls:// for the connection:

$conn = new eppConnection();
$conn->setHostname('tls://HOST');
$conn->setPort(PORT);
$conn->setUsername('******');
$conn->setPassword('******');
$conn->connect();
if ($conn->login()) {
    echo "login complete";
    //...
}
if ($conn->disconnect()) {
    echo "logout complete";
}

Hope this helps other people with the same error messages