2

The place I work is migrating our site from a hosting to google cloud. The problem is that our site consume data from a Firebird database from another server and in the new virtual server we can't connect most times (just 1 out of 6 at most).

The site is old (we use pear and no framework), but too big to remake from scratch and the client is too important to be messing around with the availability of the application.

We connect this way:

$dsni = "ibase://user:password@SERVER_IP:3050/DB_NAME";
$data = DB::connect($dsni);
if (PEAR::isError($data)) {
    echo $data->getDebugInfo();
    exit();
}

This works perfectly fine in our actual server: Ubuntu Server 14.04.1 LTS with a php-firebird-2.5 driver.

I've tried it in my desktop and also works with Mint 17 and same Firebird driver. But in the google-cloud server with an Ubuntu Server 18.04 LTS and php-firebird-3.0 driver doesn't.

The next error shows up:

[nativecode=connection rejected by remote interface] **
ibase://user:password@SERVER_IP:3050/DB_NAME

I'm believing it could be the driver problem, but i couldn't figure out a way to downgrade it to 2.5 in the 18.04 distro.

Can anyone please give me a hand?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Re: downgrade. FB3 introduced "new" system of users and passwords - named "SRP" - which works simultaneously with the earlier system, retroactively named "Legacy". FB3 also introduced connection encryption, that was never done by FB itself before. So, you may try to 1) create "Legacy" users not only "SRP" users in FB3. 2) Edit `firebird.conf` and make "Legacy" preferred or even the only authentication plugin. 3) Edit `firebird.conf` and make wire protocol encryption enabled or even disabled, rather than required. 4) restart Firebird 3 service and hope it is now compatible with FB 2 clients – Arioch 'The Dec 20 '18 at 12:53
  • 1
    However that probably is not the real problem, cause you would have then consistent denials most probably, instead of "1 of 6 connections succeed" – Arioch 'The Dec 20 '18 at 12:57
  • Which version of libfbclient is installed on this PHP server? 2.5 or 3.0? What is the firebird.conf setting on the database server for `WireCrypt`, `AuthServer`, `UserManager`, if you are able to login, what is the output for `select * from mon$attachments where MON$ATTACHMENT_ID = CURRENT_CONNECTION` (most importantly the `MON$CLIENT_VERSION`, `MON$REMOTE_VERSION` and `MON$AUTH_METHOD`)? – Mark Rotteveel Dec 20 '18 at 16:35
  • Possibly related (although not 100% sure, because it should lead to consistent rejection): https://stackoverflow.com/questions/30390465/connection-rejected-by-remote-interface-connecting-to-firebird-3-with-pdo, https://stackoverflow.com/questions/46942199/gds-exception-335544421-connection-rejected-by-remote-interface (this one is for Java, but the possible causes and configuration of Firebird applies). Maybe this will give you some things to try. – Mark Rotteveel Dec 20 '18 at 16:43
  • Mark Rotteveel i've got: nativecode=Dynamic SQL Error SQL error code = -204 Table unknown MON$ATTACHMENTS At line 2, column 39. I've set WireCrypt = Enabled, AuthServer = Legacy_Auth, AuthClient = Legacy_Auth, UserManager = Legacy_UserManager following Arioch-'The proposal, but still the same.... – Alejandro Albornoz Dec 20 '18 at 20:30
  • 1
    `Table unknown MON$ATTACHMENTS` - o_O - that just can not be. It is there since Firebird 2.1 // so who knows where you manage to be connecting to - but it is either pre-2.1 Firebird or not Firebird at all (Interbase, Yaffil, whatever) // c:\Program Files\Firebird\Firebird_2_1\doc\README.monitoring_tables.txt // UPD. I think that FB 2.x when opening old database (with ODS matching Interbase 5 or 6 or FB 1.x) would also prohibit nom-tables, but did not try. FB3 however does not have backward formats compatibility, so FB3 can not be opening "too old to have mon$" FDB files – Arioch 'The Dec 21 '18 at 08:35
  • I agree with Arioch'The, that would indicate that you are not connecting to a Firebird 3 server, but to a Firebird 2.0 or earlier (or at least to a Firebird 2.5 or earlier server with an ODS 11 or older database), or not a Firebird server at all. – Mark Rotteveel Dec 21 '18 at 08:37
  • Regarding the config, I'd suggest not to set `AuthServer` to only `Legacy_Auth`, but to `Srp,Legacy_auth` and `UserManager` to `Legacy_UserManager,Srp`. – Mark Rotteveel Dec 21 '18 at 08:39
  • Given the number of comments we already posted, this sounds like a problem that might be more suitable to ask on the firebird-support mailing list as it seems this will need more troubleshooting than is suitable for Stack Overflow. – Mark Rotteveel Dec 21 '18 at 08:41
  • can he query server version when luckily openning connection using CLI tools like isql ? assuming there is not "rdb$get_context" yet. There are API calls in client DLL, but is there a thing like this exposed on CLI level? run a utility in the loop until it produces some answer... – Arioch 'The Dec 21 '18 at 08:53
  • `I've set ..... UserManager = Legacy_UserManager following Arioch-'The proposal` - my proposal included the step #1 that you did not mention - that was CREATING USERS for the Legacy plugin. What you reportedly did seems to risk entering a dead end: having only SRP users (or no any users at all ???) then prohibiting SRP and thus having zero login-capable users left. – Arioch 'The Dec 21 '18 at 08:57
  • I've managed to access to the firebird server by Flamerobin (in my mint distro of my developer pc) and check its versión. It's Firebird 1.5. What should i do to connect with a 3.0 client (on the google cloud) to a 1.5 server? – Alejandro Albornoz Dec 21 '18 at 14:39
  • Connecting to Firebird 1.5 using a Firebird 3 client should work, assuming you haven't messed with the `ÀuthClient` (or at least includes `Legacy_Auth`), `WireCrypt` (or at least is **not** set to `Required`) and `Providers` (or at least includes `Remote`) settings of the `firebird.conf` read by this client library. But as I said before: take this question to the firebird-support mailing list; you have too many unknowns and moving parts to clearly answer on Stack Overflow. – Mark Rotteveel Dec 21 '18 at 18:29
  • 1
    Thanks all for your collaboration. I've managed to solve the problem. What i've done is change the AuthClient value to Legacy_Auth and the UserManager to Legacy_UserManager and still the same. But what it solved besides the mentioned actions is to move the firebird.conf file at /etc/firebird/3.0/ to /usr/lib/x86_64-linux-gnu/firebird/3.0/ – Alejandro Albornoz Dec 26 '18 at 15:35

0 Answers0