Cybersec + build process (#777)

* add a page about cybersec

* WIP build process

* finished build process

* simplify and enhance wiki section erase flash

* add [ESP444]RESEt solution

* add ESP710

* add link to discussion FAQ

* code review

* add links to core installation process
This commit is contained in:
Julien Staub 2022-06-11 09:42:40 +02:00 committed by GitHub
parent d0a3066919
commit 3da4967476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 109 additions and 59 deletions

View File

@ -0,0 +1,26 @@
# Cybersecurity concerns
## Concerns
If you plan to have access to you ESP from outside of your private network than you need to apply some basic security rules to avoid anybody to be able to access your ESP.
__Disclaimer__ : this wiki is for reference - you are responsible of your board and internet network, we are not responsible for any damage to any of your network appliances.
## Recommendations
Following steps must be done **before** your ESP is visible from public internet:
- Activate authentication in config.h file
- Change default user and password (this can be done from config.h or later with commands)
Is also strongly recommended to:
- Use strong passwords
- Use unique passwords, not same as for other accounts
- Change password regularly
- Configure box to redirect a different port than 80 to the port 80 of ESP
- Use [DMZ](https://en.wikipedia.org/wiki/DMZ_(computing)) feature of your box
## Additional tips
- Remember the web server is not https, this means the server will never be fully secure. In particular, avoid to connect to your printer from any public network you do not own. Stick to your 4G network or other safe places to avoid [MITM attack](https://en.wikipedia.org/wiki/Man-in-the-middle_attack)

View File

@ -1,81 +1,104 @@
# Install instructions
# Buildind code
## For people not willing to read check this great video from Chris Riley
## Table of contents
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/pJGBRriNc9I/0.jpg)](https://www.youtube.com/watch?v=pJGBRriNc9I)
- [Building with PlatformIO and VScode (recommended method)](#Building-with-PlatformIO-and-VScode-(recommended-method))
- [Building with Arduino IDE](#Building-with-Arduino-IDE)
- [Video guide by Chris Riley](#Video-guide-by-Chris-Riley)
- [Written guide](#Written-guide)
- [Common steps for all methods](#Common-steps-for-all-methods)
- [Additional tips](#Additional-tips)
- [Full ESP erase](#Full-ESP-erase)
## Compiling with Arduino IDE
## Building with PlatformIO and VScode (recommended method)
### Programming board
1. Download and install [Visual Studio Code](https://code.visualstudio.com/)
2. Download [latest release](https://github.com/luc-github/ESP3D/releases/latest) of this project
- Extract it anywhere
3. Open the forlder containing the project from within VScode (file->open folder)
4. Let VScode install exptension packages recommended by the project.
- A popup should appear in lower right corner
- It will install extensions listed in .vscode/extensions.json
- Wait for complete installation
5. Build with PlatformIO
- Click to open the platformIO tab on the left (or ctrl+maj+P and type `View: Show PlatformIO`)
- Unwrap target corresponding to your board
- Click on `Upload` to build and upload FW to ESP board
`1.` Arduino IDE
`1.1` Download Arduino IDE version 1.X from <https://www.arduino.cc/en/Main/Software>
`1.2` Install the Arduino IDE
Follow additional steps [here](#Common-steps-for-all-methods)
`2.` Open the Arduino IDE and click File, Preferences
`2.1` In the "Additional Boards Manager URL field: Paste: <http://arduino.esp8266.com/stable/package_esp8266com_index.json>
`2.2` Click OK
`2.3` Click Tools -> Boards -> Board Manager
`2.4` Scroll to near the bottom, and find "esp8266 by ESP8266 Community) and click on the row
`2.5` On the "Select Version" dropdown, select latest version and click Install
`2.6` Wait for the ESP8266 support to be installed
`2.7` Download the latest release and manually copy the libraries present in the ESP3D-x.y.z/libraries directory into your Arduino/libraries directory. (no need if using platformIO). These versions are verified to work with ESP3D, any others (newer version) may cause untested behavior.
## Building with Arduino IDE
`3.` Download and install the SPIFFS Uploader tool
**EDIT:This part is no more necessary since FW 0.9.99 which contains self uploader**
`3.1` Go to <https://github.com/esp8266/Arduino/blob/master/doc/filesystem.rst#uploading-files-to-file-system>
`3.2` Download the ESP8266FS tool from the page above
`3.3` Open a file manager to your Arduino sketchbook directory. If you don't know where that is, click File, Preferences in the Arduino IDE and look at the field: Sketchbook Location
`3.4` Inside your sketchbook folder, create a new directory called 'tools'
`3.5` Extract the content of ESP8266FS-x.x.x.zip into Tools (So it ends up with something like /home/user/Documented/sketchbook/tools/ESP8266FS/tool/esp8266fs.jar
`3.6` Restart the Arduino IDE
### Video guide by Chris Riley
`4.` Download the latest release of this project:
<https://github.com/luc-github/ESP3D/releases/latest>
`4.1` Extract it to your sketchbook or other location
`4.2` Open the Arduino IDE and open the ESP3D subdirectory (ESP8266 for older versions) -> esp3d.ino (or esp8266.ino for older versions)
[![Chris Riley ESP3D build video](https://img.youtube.com/vi/pJGBRriNc9I/0.jpg)](https://www.youtube.com/watch?v=pJGBRriNc9I)
`5.` Configure your Board
_NB: Read [this article for NB notes](https://github.com/luc-github/ESP8266/wiki/Flash-Size) on selecting the correct Board settings._
To recap:
`5.1` Make sure you have the clock speed set to 160Mhz
`5.2` Make sure you have the correct Flash size selected (More details [here](https://github.com/luc-github/ESP8266/wiki/Flash-Size#figuring-out-the-flash-size))
### Written guide
`6.` Upload the sketch
`6.1` Configure your ESP8266 for upload (USB to serial plugged in, GPIO0 and GPIO15 pulled low, RST pulled high)
`6.2` Click the Upload button in Arduino IDE (Or press Ctrl+U)
1. Arduino IDE
- Download Arduino IDE version 1.x.y from <https://www.arduino.cc/en/Software>
- Install the Arduino IDE
2. Additional libraries
- Open the Arduino IDE go to File -> Preferences
- In the "Additional Boards Manager URL" field, add following URLs:
- <https://arduino.esp8266.com/stable/package_esp8266com_index.json> details about installation [here](https://github.com/esp8266/Arduino#installing-with-boards-manager)
- <https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json> details about installation [here](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html)
- Click OK
- Click Tools -> Boards -> Board Manager
- Scroll to near the bottom, and find "esp8266 by ESP8266 Community" and click on the row
- On the "Select Version" dropdown, select version according to [ESP3D home page](https://github.com/luc-github/ESP3D)
- Wait for the ESP8266 support to be installed
3. Download [latest release](https://github.com/luc-github/ESP3D/releases/latest) of this project
- Extract it to your sketchbook or other location
- Copy the libraries present in the ESP3D-x.y.z/libraries directory into your Arduino/libraries directory. These versions are verified to work with ESP3D, any others (newer version) may cause untested behavior. More information about libraries installation options [here](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries)
- Open the Arduino IDE and open the project file esp3d/esp3d.ino (ESP8266/esp8266.ino for older versions)
4. Configure for your board
- [Get flash sise of your board](https://github.com/luc-github/ESP3D/wiki/Flash-Size#figuring-out-the-flash-size)
- Apply [correct setting](https://github.com/luc-github/ESP3D/wiki/Flash-Size) in Arduinio -> tools ->board
- Double check you have the clock speed set to 160Mhz
- Double check you have the correct Flash size selected
5. Upload the sketch
- Configure your ESP8266 or ESP32 for upload (USB to serial plugged in, GPIO0 and GPIO15 pulled low, RST pulled high)
- Click the Upload button in Arduino IDE (Or press Ctrl+U)
`7.` Fire up a device and scan for WIFI access points
`7.1` Reboot the ESP8266 into run mode (USB to serial removed , GPIO0 pulled high, GPIO15 pulled low, RST pulled high)
`7.2` Find the AP called **ESP3D** (or ESP8266 in older versions)
`7.3` Connect to the AP using the default password of **12345678**
`7.4` Upload index.html.gz file to the SPIFFS filesystem using web page uploader
Follow additional steps [here](#Common-steps-for-all-methods)
### Initial Configuration
## Common steps for all methods
`9.` Open device web page on the AP connected device
`9.1` Accept Captive portal redirect or
`9.2` Open a web browser and navigate to <http://192.168.0.1>
6. Starting the board
- Reboot the ESP8266 or ESP32 into run mode (USB to serial removed , GPIO0 pulled high, GPIO15 pulled low, RST pulled high)
- Find the wifi AP (Access Point) called **ESP3D** (or ESP8266 in older versions)
- Connect to the wifi AP using the default password of **12345678**
7. Initial configuration
- Open device web page on the AP connected device with one of 2 following options:
- Accept Captive portal redirect
- Open a web browser and navigate to <http://192.168.0.1>
- Upload index.html.gz file to the SPIFFS filesystem using web page uploader
8. Configure device
- If authentication is enabled use pair user/password **admin**/**admin**
- I recommend changing to Station mode and connecting to your home/office Wifi instead of staying in AP mode
- You may want to change the Baud rate
- You can change to DHCP, or at the very least setup a Static IP you are familiar with
9. Connect ESP board to your printer motherboard
- More details can be found [here](https://github.com/luc-github/ESP3D/wiki/Hardware-connection)
`10.` Login in using **admin**/**admin** and configure the device to your choosing
`10.1` I recommend changing to Station mode and connecting to your home/office Wifi instead of staying in AP mode
`10.2` You may want to change the Baud rate
`10.3` You can change to DHCP, or at the very least setup a Static IP you are familiar with.
## Additional tips
### Wire up and use
- If you plan to access your ESP from public network, think about [cybersecurity](https://github.com/luc-github/ESP3D/wiki/Cybersecurity-concerns)
`11.` Connect to your printer's serial port
- You can use Arduino serial monitor or PlatformIO `Monitor` target to see debug info from ESP and send commends for configuration. Commands are documented in wiki/docs folder
### Other things to keep in mind
- After applying power the ESP takes several seconds before it will send `M117 <ip address>` on the serial port. The delay can be up to 30 seconds depending on configuration. If your printer is connected to the ESP, and has an LCD connected, the M117 command is "Print this message to the LCD" - i.e after a successful boot it will print the IP address to the printer's LCD
* After applying power the ESP8266 takes approx 10 seconds before it will send `M117 <ip address>` on the serial port. If your printer is connected to the ESP8266, and has an LCD connected, the M117 command is "Print this message to the LCD" - i.e after a successful boot it will print the IP address to the printer's LCD
- Depending on configuration file, you may pull down GPIO2 during reset/powerup to wipe the settings stored in EEPROM.
* If you mess up a configuration you can pull down GPIO2 during reset/powerup to wipe the settings stored in EEPROM.
- If behavior is not consistent, you may need to erase the full flash on ESP board.
## Still having issue ?
## Full ESP erase
If behavior is not consistent, you may need to erase the full flash, for that use the esptool present in your ESP core instalation in tools directory with option `--chip auto erase_flash`
So in my case on git version of ESP32 under windows :
`C:\Users\user\Documents\Arduino\hardware\espressif\esp32\tools\esptool>esptool.exe --chip auto erase_flash`
There are several options to erase flash configuration:
esptool can also be found here : <https://github.com/espressif/esptool>
- Execute `[ESP710]FORMAT` (or `[ESP710]FORMATFS` for newer versions) after upload and restart the board. It's also possible to do `[ESP444]RESET` to reset only EEPROM parameters without erasing SPIFF memory.
- In Arduino IDE, you can configure erase method in tools->Erase Flash->All Flash content. This will erase whole memory at next upload.
- Using PlatformIO if there is a target Patform->Erase Flash for your board
- Using [esptool](https://github.com/espressif/esptool) with command `esptool.exe --chip auto erase_flash`

View File

@ -8,3 +8,4 @@
* [Install-Instructions](https://github.com/luc-github/ESP3D/wiki/Install-Instructions)
* [Notifications](https://github.com/luc-github/ESP3D/wiki/Notifications)
* [Frequent Asked Questions](https://github.com/luc-github/ESP3D/issues?q=is%3Aissue+is%3Aclosed+label%3AFAQ)
* [Frequent Asked Questions 2](https://github.com/luc-github/ESP3D/discussions/categories/f-a-q)