1

I have a site setup which feels fairly unconventional so please bare with me while I try to explain.

I have 2 Drupal sites based on different servers.

The main site (site A) contains the front-end site and holds user data. The second site (site B) is our internal system and has 2 databases. This is a standard Drupal db and a db that contains other customer data (e.g. sales information, downloads and product info etc).

When a user logs in to their account on the main site, I need to be able to access information on the second database and display this to the user.

I know I can do this without using Drupal with a mysqli statement. However, I need to be able to access this information securely via SSL.

I have very little knowledge of encryption so my initial thought was that if both sites had SSL, the information received would be sent encrypted when using mysqli. However, I think I am very wrong.

My next thought would be to request the information via the second Drupal site perhaps via an API of some sort. However I'm not sure this would offer any more security or if I have missed the point entirely.

Would anyone be able to advise me on the best way access this information please?

6
  • SSL on the site with the database server will be encrypted if you are accessing it through HTTPS. Are you accessing the data from the other sever over HTTPS or some other protocol?
    – Jaypan
    Feb 7, 2017 at 15:10
  • I'm can access both site A and Site B via https, if that is what you're asking. In my dev i'm currently getting the data using mysqli_query and mysqli_connect Feb 7, 2017 at 15:18
  • Are you accessing a local or a remote database with mysqli_connect()?
    – Jaypan
    Feb 7, 2017 at 15:20
  • Site B is a remote site Feb 7, 2017 at 15:22
  • There is currently nothing btw. This is all just theoretical but this is how it would need to be set up if it were to be made Feb 7, 2017 at 15:26

1 Answer 1

0

The easiest way to do this would be to set up a new MySQL user on Server B that had something like: GRANT SELECT ON serverBdata TO 'serverAuser'@'serverA-IP';

Then you can write a module on server A that connects and retrieves that data.

If that's not going to work, you can look at setting up a menu hook on Server B that delivers the data in a sensible way, such as JSON, over HTTPS.

if you wanted to get really fancy, you could also encrypt the JSON.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.