metaregistrar / php-epp-client

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

Trying to connect/test EIF EPP server #243

Closed matbcvo closed 4 years ago

matbcvo commented 4 years ago

I am trying to connect/test EIF (.ee) EPP server. https://www.internet.ee/registrar-portal/help-and-info/eif-s-information-systems-and-technical-conditions https://meedia.internet.ee/files/Appendix%201.pdf

What I don't understand is that why connection is unexpectedly closed by remote host, can't figure out what's the reason. Incorrect certificate (using .crt I got from EIF when I sent them .csr)? Or incorrect login details?

Log

ERROR: Unexpected closed connection by remote host...

==== LOG ====
-----Connection made-----2020-03-05 10:08:41-----
Stream opened with protocol TLSv1.2, cipher ECDHE-RSA-AES128-GCM-SHA256, 128 bits TLSv1.2
-----END-----2020-03-05 10:08:41-----

-----WRITE-----2020-03-05 10:08:51-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <command>
    <login>
      <clID>XXXXXXXXXXXXXXXX</clID>
      <pw>XXXXXXXXXXXXXXXX</pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
      </svcs>
    </login>
    <clTRID>5e60c1a3028d3</clTRID>
  </command>
</epp>

-----END-----2020-03-05 10:08:51-----

PHP file

<?php
require("autoloader.php");

use Metaregistrar\EPP\eppConnection;
use Metaregistrar\EPP\eppException;
use Metaregistrar\EPP\eppCheckDomainRequest;
use Metaregistrar\EPP\eppCheckDomainResponse;

$conn = new Metaregistrar\EPP\eppConnection(true);
$conn->setHostname('tls://testepp.internet.ee');
$conn->setPort(700);
$conn->setUsername('***');
$conn->setPassword('***');
$conn->enableCertification('cert.crt.pem', null);

try {
        // Connect and login to the EPP server
        if ($conn->login()) {
            echo "Checking balance\n";
            checkbalance($conn);
            $conn->logout();
        }
} catch (eppException $e) {
    echo "ERROR: " . $e->getMessage()."\n";
    echo $e->getLastCommand();
    echo "\n\n";
}
?>
metaregistrar commented 4 years ago

99% of the cases where the error is "ERROR: Unexpected closed connection by remote host" it is a whitelisting problem - please whitelist your IP addresses with the registry

metaregistrar commented 4 years ago

Alternatively, you can try to connect to ssl://testepp.internet.ee or even completely remove the tls:// (because you are using the 'enableCertification' call)

matbcvo commented 4 years ago

Thanks for reply. Our IPs are whitelisted, since we can use their web interface (https://testrar.internet.ee/). But I'll contact EIF to make sure they whitelisted our IPs for EPP server.

I tried changing from TLS to SSL (or removing tls://), still getting same error.

ERROR: Unexpected closed connection by remote host...

==== LOG ====
-----Connection made-----2020-03-05 10:44:25-----
Stream opened with protocol TLSv1.2, cipher ECDHE-RSA-AES128-GCM-SHA256, 128 bits TLSv1.2
-----END-----2020-03-05 10:44:25-----

-----WRITE-----2020-03-05 10:44:35-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <command>
    <login>
      <clID>XXXXXXXXXXXXXXXX</clID>
      <pw>XXXXXXXXXXXXXXXX</pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
      </svcs>
    </login>
    <clTRID>5e60ca030b2af</clTRID>
  </command>
</epp>

-----END-----2020-03-05 10:44:35-----
ERROR: Unexpected closed connection by remote host...

==== LOG ====
-----Connection made-----2020-03-05 10:47:35-----
Stream opened
-----END-----2020-03-05 10:47:35-----

-----WRITE-----2020-03-05 10:47:45-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <command>
    <login>
      <clID>XXXXXXXXXXXXXXXX</clID>
      <pw>XXXXXXXXXXXXXXXX</pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
      </svcs>
    </login>
    <clTRID>5e60cac105a63</clTRID>
  </command>
</epp>

-----END-----2020-03-05 10:47:45-----
matbcvo commented 4 years ago

I contacted EIF and they confirmed that our IPs are whitelisted, but they told me that error was about certificate issue. I checked/fixed certificate, now it seems to be able to connect/login EIF EPP server.

ERROR: Error 2001: 2:0: ERROR: Element '{urn:ietf:params:xml:ns:epp-1.0}epp': No matching global declaration available for the validation root.
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="lib/schemas/epp-ee-1.0.xsd">
  <response>
    <result code="2001">
      <msg lang="en">2:0: ERROR: Element '{urn:ietf:params:xml:ns:epp-1.0}epp': No matching global declaration available for the validation root.</msg>
    </result>
    <trID>
      <clTRID>5e6113a33a2ec</clTRID>
      <svTRID>ccReg-3190653033</svTRID>
    </trID>
  </response>
</epp>

==== LOG ====
-----Connection made-----2020-03-05 15:58:43-----
Stream opened with protocol TLSv1.2, cipher ECDHE-RSA-AES128-GCM-SHA256, 128 bits TLSv1.2
-----END-----2020-03-05 15:58:43-----

-----WRITE-----2020-03-05 15:58:43-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  <command>
    <login>
      <clID>XXXXXXXXXXXXXXXX</clID>
      <pw>XXXXXXXXXXXXXXXX</pw>
      <options>
        <version>1.0</version>
        <lang>en</lang>
      </options>
      <svcs>
        <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
        <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
      </svcs>
    </login>
    <clTRID>5e6113a33a2ec</clTRID>
  </command>
</epp>

-----END-----2020-03-05 15:58:43-----

-----READ-----2020-03-05 15:58:43-----
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="lib/schemas/epp-ee-1.0.xsd">
  <response>
    <result code="2001">
      <msg lang="en">2:0: ERROR: Element '{urn:ietf:params:xml:ns:epp-1.0}epp': No matching global declaration available for the validation root.</msg>
    </result>
    <trID>
      <clTRID>5e6113a33a2ec</clTRID>
      <svTRID>ccReg-3190653033</svTRID>
    </trID>
  </response>
</epp>

-----END-----2020-03-05 15:58:43-----

-----DISCONNECT-----2020-03-05 15:58:43-----
Disconnected
-----END-----2020-03-05 15:58:43-----