Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Networking/ESP8266WiFi/WiFiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,7 @@ bool WiFiInterface::ImportTlsFromSd(const StringRef& reply) noexcept

supportsTls = true;

#if HAS_MASS_STORAGE || HAS_SBC_INTERFACE
// Securely delete the SD copies - they now live in ESP flash
String<MaxFilenameLength> path;
path.copy(TlsCertFile);
Expand All @@ -1144,6 +1145,10 @@ bool WiFiInterface::ImportTlsFromSd(const StringRef& reply) noexcept
(void)MassStorage::SecureDelete(path.GetRef(), ErrorMessageMode::messageAlways);

reply.copy("TLS cert/key imported to WiFi module flash; SD copies wiped and deleted");
#else
// The source is a read-only embedded filesystem, so there is nothing to delete afterwards.
reply.copy("TLS cert/key imported to WiFi module flash");
#endif
return true;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Networking/LwipEthernet/LwipEthernetInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ GCodeResult LwipEthernetInterface::EnableInterface(int mode, const StringRef& ss
// Only honoured while the interface is down, matching the documented rule
if (tlsParam < 0 && !activated)
{
#if HAS_MASS_STORAGE || HAS_SBC_INTERFACE
bool wiped = false;
String<MaxFilenameLength> path;
path.copy(TlsCertFile);
Expand All @@ -872,6 +873,10 @@ GCodeResult LwipEthernetInterface::EnableInterface(int mode, const StringRef& ss
{
platform.Message(NetworkInfoMessage, "TLS: stored cert/key wiped and deleted from /sys/\n");
}
#else
// Nothing to wipe: with an embedded filesystem there is no writable storage to have kept them on.
platform.Message(NetworkInfoMessage, "TLS: no writable storage, nothing to wipe\n");
#endif
}
const bool tlsAllowedParam = (tlsParam > 0);
#else
Expand Down
Loading