Common stuff for all my devices' web server pages: css, login, log, ipv4, ipv6, firmware update, clock, reset info etc.

Dependents:   oldheating gps motorhome heating

Security

A password has to be set whenever there has been a software reset. Resets following faults or power on do not require a new password as the hash is restored from the RTC GPREG register.

The password is not saved on the device; instead a 32 bit hash of the password is saved. It would take 2^31 attempts to brute force the password: this could be done in under a month if an attempt were possible every millisecond. To prevent this a 200 ms delay is introduced in the reply to the login form, that gives a more reasonable 13 years to brute force the password.

Once the password is accepted a random session id is created. This is 36 bit to give six base 64 characters but without an extra delay. If an attempt could be made every ms then this would still take over a year to brute force.

The most likely attack would to use a dictionary with, say, 10 million entries against the password which would still take 20 days to do.

Committer:
andrewboyson
Date:
Mon Apr 08 10:13:01 2019 +0000
Revision:
86:f3c9beec4ee7
Child:
88:2857259fc2b4
Split the NET page into general net, net ipv4 and net ipv6. Also made the arp and dns update through ajax.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 86:f3c9beec4ee7 1 "'use strict';\n"
andrewboyson 86:f3c9beec4ee7 2 "\n"
andrewboyson 86:f3c9beec4ee7 3 "var response = '';\n"
andrewboyson 86:f3c9beec4ee7 4 "var headers = '';\n"
andrewboyson 86:f3c9beec4ee7 5 "var arp = '';\n"
andrewboyson 86:f3c9beec4ee7 6 "var dns = '';\n"
andrewboyson 86:f3c9beec4ee7 7 "\n"
andrewboyson 86:f3c9beec4ee7 8 "function parseAjax()\n"
andrewboyson 86:f3c9beec4ee7 9 "{\n"
andrewboyson 86:f3c9beec4ee7 10 " var topics = response.split('\\f');\n"
andrewboyson 86:f3c9beec4ee7 11 " arp = topics[0];\n"
andrewboyson 86:f3c9beec4ee7 12 " dns = topics[1];\n"
andrewboyson 86:f3c9beec4ee7 13 "}\n"
andrewboyson 86:f3c9beec4ee7 14 "function displayGeneral()\n"
andrewboyson 86:f3c9beec4ee7 15 "{\n"
andrewboyson 86:f3c9beec4ee7 16 " var elem;\n"
andrewboyson 86:f3c9beec4ee7 17 "\n"
andrewboyson 86:f3c9beec4ee7 18 " elem = document.getElementById('ajax-response' ); if (elem) elem.textContent = response;\n"
andrewboyson 86:f3c9beec4ee7 19 " elem = document.getElementById('ajax-headers' ); if (elem) elem.textContent = headers;\n"
andrewboyson 86:f3c9beec4ee7 20 " elem = document.getElementById('ajax-arp' ); if (elem) elem.textContent = arp;\n"
andrewboyson 86:f3c9beec4ee7 21 " elem = document.getElementById('ajax-dns' ); if (elem) elem.textContent = dns;\n"
andrewboyson 86:f3c9beec4ee7 22 "}\n"
andrewboyson 86:f3c9beec4ee7 23 "\n"
andrewboyson 86:f3c9beec4ee7 24 "var ajax;\n"
andrewboyson 86:f3c9beec4ee7 25 "function AjaxRequest(request) //Used by this script and from HTML page\n"
andrewboyson 86:f3c9beec4ee7 26 "{\n"
andrewboyson 86:f3c9beec4ee7 27 " ajax=new XMLHttpRequest();\n"
andrewboyson 86:f3c9beec4ee7 28 " ajax.onreadystatechange=handleAjaxResponse;\n"
andrewboyson 86:f3c9beec4ee7 29 " if (request) ajax.open('GET', '/net4-ajax' + '?' + request, true);\n"
andrewboyson 86:f3c9beec4ee7 30 " else ajax.open('GET', '/net4-ajax' , true);\n"
andrewboyson 86:f3c9beec4ee7 31 " ajax.send();\n"
andrewboyson 86:f3c9beec4ee7 32 "}\n"
andrewboyson 86:f3c9beec4ee7 33 "function requestAjax() //Used in this script\n"
andrewboyson 86:f3c9beec4ee7 34 "{\n"
andrewboyson 86:f3c9beec4ee7 35 " AjaxRequest('');\n"
andrewboyson 86:f3c9beec4ee7 36 "}\n"
andrewboyson 86:f3c9beec4ee7 37 "\n"
andrewboyson 86:f3c9beec4ee7 38 "function handleAjaxResponse()\n"
andrewboyson 86:f3c9beec4ee7 39 "{\n"
andrewboyson 86:f3c9beec4ee7 40 " if (ajax.readyState==4 && ajax.status==200)\n"
andrewboyson 86:f3c9beec4ee7 41 " {\n"
andrewboyson 86:f3c9beec4ee7 42 " response = ajax.responseText;\n"
andrewboyson 86:f3c9beec4ee7 43 " headers = ajax.getAllResponseHeaders();\n"
andrewboyson 86:f3c9beec4ee7 44 " parseAjax();\n"
andrewboyson 86:f3c9beec4ee7 45 " displayGeneral();\n"
andrewboyson 86:f3c9beec4ee7 46 " }\n"
andrewboyson 86:f3c9beec4ee7 47 "}\n"
andrewboyson 86:f3c9beec4ee7 48 "\n"
andrewboyson 86:f3c9beec4ee7 49 "function init()\n"
andrewboyson 86:f3c9beec4ee7 50 "{\n"
andrewboyson 86:f3c9beec4ee7 51 " setInterval(requestAjax, 10000);\n"
andrewboyson 86:f3c9beec4ee7 52 " requestAjax();\n"
andrewboyson 86:f3c9beec4ee7 53 "}\n"
andrewboyson 86:f3c9beec4ee7 54 "if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init ); // Loading hasn't finished yet\n"
andrewboyson 86:f3c9beec4ee7 55 "else init(); //`DOMContentLoaded` has already fired\n"
andrewboyson 86:f3c9beec4ee7 56 ""