I have started a home automation system with a Mega and Ethernet shield.
With the kind assistance and guidance of zoomkat, I have the ethernet server working just as I want it.
My only concern is that anyone could (probably accidentally) connect to my served page and use the served web page to adjust settings to the home system and alarm / intruder detection system.
My thoughts to prevent this are :
- declare a variable $passID
- when first serving up the page, if $passID is empty, display only a textbox (type = password) and a submit button.
- if the server receives a value from the password textbox, check that it is valid ( to a hard coded value on the server ).
- if valid, assign the current millis value to $passID, and display the full page (list of controls), and prepend the $passID to all the link values.
- if a link is received, check that the $passID (in the link) exists as a valid issued ID, and that the ID is not older than, say, 5 minutes (millis + 5 min), and perform the operation relevant to the link.
- if the textbox is empty, or not a valid password, or $passID is older than 5 minutes, then re-display the password textbox and submit button.
Any obvious flaws or oversights ?