A
A
Angelxalfa2015-04-02 16:35:15
PHP
Angelxalfa, 2015-04-02 16:35:15

Accessing a script on the local network?

Hello!
Situation:
There are two servers, let's call them 1 and 2
1 - it has Internet access, it hosts a website, and it is aimed at interacting with website users. It works on a bunch of LAMP. The site is powered by Wordpress.
2 - does not have access to the Internet, but is connected to server 1 locally. It is running Linux+Apache+php+postgress. The database contains highly sensitive and confidential information.

The idea is as follows - the user of the site accesses serv.1 and wants to get some of his information from the database ->
clicks the get button ->
an AJAX script is launched, which sends certain identification and authorization data to the php script on serv.2 via the post or get method (via locale) ->
the script checks the authorization data, clears the request from possible injections and, according to the identification data, takes information from the database and feeds it to the AJAX script on serv1->
The latter displays it on the user's screen.

Why such hemorrhoids? In order for the database with important information not to be directly accessible from the Internet, and in case of a possible hacking of the site, it was not stolen.

So the question is - How can I use an AJAX script from serv1 to a php script on serv2? How can I find the path to this script?
And in general, advice is needed - is the scheme working? And in reality, does it provide such tough base protection as it seems in theory?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Adamos, 2015-04-02
@Adamos

If your external server is hacked, it is unlikely that anything will prevent the hacker from leaving it in the local area.
No matter how it turns out that by building non-standard solutions, you really do not benefit from them except for a headache.

F
FanatPHP, 2015-04-02
@FanatPHP

The AJAX script is not accessing from the server.
It is impossible to access server 2
with an AJAX script In order to be able to access server 2 with an AJAX script, it must have access to the Internet.
That's right, for starters.

S
Sergey, 2015-04-02
@serzik

did this with fopen

M
Mike, 2015-04-02
@Mike77

not ajax but jsonp
stackoverflow.com/a/6879276
But, IMHO this is nonsense) just set the configs correctly, don't be paranoid

S
ShamblerR, 2015-04-03
@ShamblerR

damn man, tell me honestly, how do you like this layout of the
frontend apache all things, the database is connected as
host: vasya.pupkin.vasiliy.vasya.vaska.loh
and 192.128.4.5 is registered in the host file, you can stupidly use the internal ip
as a result, you get
1 .when receiving a host login and password, you can connect to them, as you understand, only from a local machine, because Ip is gray
2. database no crutches
3. what else do you need for a good life?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question