Skip to content

Commit 38a9706

Browse files
Keep secure credentials in a separate config file (#16773)
1 parent 62d9e3f commit 38a9706

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ Marlin/*/*/readme.txt
146146
Marlin/*/*/*/readme.txt
147147
Marlin/*/*/*/*/readme.txt
148148

149+
# Secure Credentials
150+
Configuration_Secure.h
151+
149152
#Visual Studio
150153
*.sln
151154
*.vcxproj

Marlin/Configuration_adv.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -3023,11 +3023,19 @@
30233023
//#define ESP3D_WIFISUPPORT // ESP3D Library WiFi management (https://github.com/luc-github/ESP3DLib)
30243024

30253025
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
3026-
#define WIFI_SSID "Wifi SSID"
3027-
#define WIFI_PWD "Wifi Password"
30283026
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery)
30293027
//#define OTASUPPORT // Support over-the-air firmware updates
30303028
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
3029+
3030+
/**
3031+
* To set a default WiFi SSID / Password, create a file called Configuration_Secure.h with
3032+
* the following defines, customized for your network. This specific file is excluded via
3033+
* .gitignore to prevent it from accidentally leaking to the public.
3034+
*
3035+
* #define WIFI_SSID "WiFi SSID"
3036+
* #define WIFI_PWD "WiFi Password"
3037+
*/
3038+
//#include "Configuration_Secure.h" // External file with WiFi SSID / Password
30313039
#endif
30323040

30333041
/**

buildroot/bin/opt_set

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ SED=$(which gsed || which sed)
88
# Logic for returning nonzero based on answer here: https://stackoverflow.com/a/15966279/104648
99
eval "${SED} -i '/\(\/\/\)*\([[:blank:]]*\)\(#define \b${1}\b\).*$/{s//\2\3 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration.h" ||
1010
eval "${SED} -i '/\(\/\/\)*\([[:blank:]]*\)\(#define \b${1}\b\).*$/{s//\2\3 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration_adv.h" ||
11-
(echo "ERROR: opt_set Can't find ${1}" >&2 && exit 9)
11+
eval "echo '#define ${@}' >>Marlin/Configuration_adv.h" ||
12+
(echo "ERROR: opt_set Can't set or add ${1}" >&2 && exit 9)

buildroot/share/tests/esp32-tests

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ set -e
1212
restore_configs
1313
opt_set MOTHERBOARD BOARD_ESPRESSIF_ESP32
1414
opt_enable WIFISUPPORT GCODE_MACROS BAUD_RATE_GCODE
15-
opt_set WIFI_SSID "\"ssid\""
16-
opt_set WIFI_PWD "\"password\""
15+
opt_add WIFI_SSID "\"ssid\""
16+
opt_add WIFI_PWD "\"password\""
1717
opt_set TX_BUFFER_SIZE 64
1818
opt_add WEBSUPPORT
1919
exec_test $1 $2 "ESP32 with WIFISUPPORT and WEBSUPPORT"

0 commit comments

Comments
 (0)