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:
Wed Mar 11 16:00:21 2020 +0000
Revision:
133:98c6bf14bc37
Parent:
132:5b2df69a4f17
Child:
147:ea6f647725a1
Addewd more fields to TCP connections

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 110:8ab752842d25 1 #include <stdint.h>
andrewboyson 110:8ab752842d25 2 #include <stdbool.h>
andrewboyson 110:8ab752842d25 3
andrewboyson 110:8ab752842d25 4 extern void WebLoginHtml (void);
andrewboyson 110:8ab752842d25 5 extern void WebLoginQuery (char* pQuery);
andrewboyson 110:8ab752842d25 6 extern bool WebLoginQueryPasswordOk;
andrewboyson 110:8ab752842d25 7 extern int WebLoginOriginalToDo;
andrewboyson 110:8ab752842d25 8 extern bool WebLoginCookiesContainValidSessionId(char* pCookies);
andrewboyson 110:8ab752842d25 9 extern char* WebLoginSessionNameGet(void);
andrewboyson 110:8ab752842d25 10 extern int WebLoginSessionNameLife(void);
andrewboyson 110:8ab752842d25 11 extern char* WebLoginSessionIdGet(void);
andrewboyson 110:8ab752842d25 12 extern void WebLoginSessionIdNew(void);
andrewboyson 110:8ab752842d25 13 extern bool WebLoginSessionIdIsSet(void);
andrewboyson 114:900e33dfa460 14 extern void WebLoginForceNewPassword (void);
andrewboyson 110:8ab752842d25 15 extern void WebLoginInit(void);
andrewboyson 110:8ab752842d25 16
andrewboyson 110:8ab752842d25 17 extern void WebFavicon (void);
andrewboyson 110:8ab752842d25 18 extern const char* WebFaviconDate;
andrewboyson 110:8ab752842d25 19 extern const char* WebFaviconTime;
andrewboyson 110:8ab752842d25 20 extern const int WebFaviconSize;
andrewboyson 110:8ab752842d25 21
andrewboyson 110:8ab752842d25 22 extern void WebBaseCss (void);
andrewboyson 110:8ab752842d25 23 extern const char* WebBaseCssDate;
andrewboyson 110:8ab752842d25 24 extern const char* WebBaseCssTime;
andrewboyson 110:8ab752842d25 25 extern void WebNavCss (void);
andrewboyson 110:8ab752842d25 26 extern const char* WebNavCssDate;
andrewboyson 110:8ab752842d25 27 extern const char* WebNavCssTime;
andrewboyson 110:8ab752842d25 28
andrewboyson 110:8ab752842d25 29 extern void WebClockHtml (void);
andrewboyson 110:8ab752842d25 30 extern void WebClockScript (void);
andrewboyson 110:8ab752842d25 31 extern const char* WebClockScriptDate;
andrewboyson 110:8ab752842d25 32 extern const char* WebClockScriptTime;
andrewboyson 110:8ab752842d25 33 extern void WebClockAjax (void);
andrewboyson 110:8ab752842d25 34 extern void WebClockQuery (char* pQuery);
andrewboyson 110:8ab752842d25 35
andrewboyson 110:8ab752842d25 36 extern void WebLogHtml (void);
andrewboyson 110:8ab752842d25 37 extern void WebLogQuery (char* pQuery);
andrewboyson 110:8ab752842d25 38
andrewboyson 110:8ab752842d25 39 extern void WebTraceHtml (void);
andrewboyson 110:8ab752842d25 40 extern void WebTraceScript (void);
andrewboyson 110:8ab752842d25 41 extern const char* WebTraceScriptDate;
andrewboyson 110:8ab752842d25 42 extern const char* WebTraceScriptTime;
andrewboyson 110:8ab752842d25 43 extern void WebTraceAjax (void);
andrewboyson 110:8ab752842d25 44 extern void WebTraceQuery (char* pQuery);
andrewboyson 110:8ab752842d25 45
andrewboyson 110:8ab752842d25 46 extern void WebNetHtml (void);
andrewboyson 132:5b2df69a4f17 47 extern void WebNetScript (void);
andrewboyson 132:5b2df69a4f17 48 extern const char* WebNetScriptDate;
andrewboyson 132:5b2df69a4f17 49 extern const char* WebNetScriptTime;
andrewboyson 132:5b2df69a4f17 50 extern void WebNetAjax (void);
andrewboyson 132:5b2df69a4f17 51
andrewboyson 110:8ab752842d25 52 extern void WebNet4Html (void);
andrewboyson 110:8ab752842d25 53 extern void WebNet4Script (void);
andrewboyson 110:8ab752842d25 54 extern const char* WebNet4ScriptDate;
andrewboyson 110:8ab752842d25 55 extern const char* WebNet4ScriptTime;
andrewboyson 110:8ab752842d25 56 extern void WebNet4Ajax (void);
andrewboyson 132:5b2df69a4f17 57
andrewboyson 110:8ab752842d25 58 extern void WebNet6Html (void);
andrewboyson 110:8ab752842d25 59 extern void WebNet6Script (void);
andrewboyson 110:8ab752842d25 60 extern const char* WebNet6ScriptDate;
andrewboyson 110:8ab752842d25 61 extern const char* WebNet6ScriptTime;
andrewboyson 110:8ab752842d25 62 extern void WebNet6Ajax (void);
andrewboyson 110:8ab752842d25 63
andrewboyson 120:85a4d8f7517d 64 extern void WebResetHtml (void);
andrewboyson 120:85a4d8f7517d 65 extern void WebResetQuery (char* pQuery);
andrewboyson 110:8ab752842d25 66
andrewboyson 110:8ab752842d25 67 extern void WebFirmwareHtml (void);
andrewboyson 110:8ab752842d25 68 extern void WebFirmwareScript(void);
andrewboyson 110:8ab752842d25 69 extern const char* WebFirmwareScriptDate;
andrewboyson 110:8ab752842d25 70 extern const char* WebFirmwareScriptTime;
andrewboyson 110:8ab752842d25 71 extern void WebFirmwareQuery (char* pQuery);
andrewboyson 110:8ab752842d25 72 extern int WebFirmwareTargetLength;
andrewboyson 110:8ab752842d25 73 extern int WebFirmwareActualLength;
andrewboyson 110:8ab752842d25 74 extern char* WebFirmwareFileName;
andrewboyson 110:8ab752842d25 75 extern void WebFirmwarePost (int contentLength, int contentStart, int size, char* pRequestStream, uint32_t positionInRequestStream, bool* pComplete);
andrewboyson 110:8ab752842d25 76 extern void WebFirmwareAjax (void);