LowPowerLab Forum

Hardware support => Moteino => Topic started by: snop on February 16, 2015, 04:50:18 PM

Title: Having index.php and gateway.js on dirfferent servers
Post by: snop on February 16, 2015, 04:50:18 PM
Hi!

I was going thru the raspberrypi home-automation gateway and got everything up and working. only with motion sensors instead of the garagemote. Im wondering if it is possible to have the index.php running on my webpage and still communicating with the gateway.js running on the pi? what changes would I have to make?

Title: Re: Having index.php and gateway.js on dirfferent servers
Post by: Felix on February 16, 2015, 10:28:54 PM
Quote from: snop on February 16, 2015, 04:50:18 PM
Im wondering if it is possible to have the index.php running on my webpage and still communicating with the gateway.js running on the pi? what changes would I have to make?
Doesn't it already do that?
You have a index.php that renders your webpage, and a gateway.js serving the back end.
Title: Re: Having index.php and gateway.js on dirfferent servers
Post by: snop on February 17, 2015, 01:23:45 AM
Yeah, I'm sorry. I was takling about uploading the php to my webserver host, ftp.domeneshop.no and than communicate with the gateway on the pi.
Title: Re: Having index.php and gateway.js on dirfferent servers
Post by: Felix on February 17, 2015, 06:18:39 AM
You sure could, but you'd need to open the socket to the world and that opens up security issues, so you'd need to secure your socket.
Why would you want to do that?
Title: Re: Having index.php and gateway.js on dirfferent servers
Post by: snop on February 17, 2015, 07:48:16 AM
Well, im really just experimenting a little bit before I decide how my project will look like. Are there many changes needed? wont I have to add som changes to the index.php also? so they can communicate over the web?
Title: Re: Having index.php and gateway.js on dirfferent servers
Post by: Felix on February 17, 2015, 09:20:16 AM
There are changes yes, but you are on your own if you want to experiment with it.
I will support and answer questions related to the setup I posted.
I would not do it the way you suggested since it's making it harder to maintain and implies more security that needs to be addressed or else it opens up security holes that could be dangerous.

Just the other day I was looking around at my Pi access logs and to my surprise I saw a hefty set of force attacks comprising of port scanning and dictionary access of URLs - things like admin/setup/config pages/files/urls. That was interesting and scary.

I suggest obfuscating the setup of your websocket and front end webserver as much as possible. Keeping the webpage on 1 server and the backend on another, separated by the internet, sounds like a really bad idea to me, unless there is a real use case or requirement, but I have yet to understand how that could be useful or how the benefit of such a setup would outweigh the disadvantages.