Remove Legacy Credential Bootstrap Paths
Decouple user provisioning from HTTPS identity storage while retaining compatible v1 user records and migrating TLS material to the credential-free v2 format. Add focused security regression coverage and update operator documentation.
This commit is contained in:
+10
-27
@@ -1,5 +1,3 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "driver/uart.h"
|
||||
#include "admin_ssh_console.h"
|
||||
#include "console_completion.h"
|
||||
@@ -132,29 +130,16 @@ void app_main(void)
|
||||
"HTTPS security material unavailable (%s); use UART0 'web reset --force' to replace it",
|
||||
esp_err_to_name(web_security_error));
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Using %s HTTPS identity and legacy recovery credential",
|
||||
web_security_source == WEB_SECURITY_LOAD_STORED ? "stored" : "newly generated");
|
||||
ESP_LOGI(TAG, "Using %s HTTPS identity",
|
||||
web_security_source == WEB_SECURITY_LOAD_STORED
|
||||
? "stored"
|
||||
: (web_security_source == WEB_SECURITY_LOAD_MIGRATED_V1
|
||||
? "migrated v1"
|
||||
: "newly generated"));
|
||||
}
|
||||
|
||||
user_database_load_result_t user_database_source = USER_DATABASE_LOAD_EMPTY;
|
||||
web_security_credentials_t legacy_credentials;
|
||||
memset(&legacy_credentials, 0, sizeof(legacy_credentials));
|
||||
user_database_legacy_credentials_t legacy = {0};
|
||||
const user_database_legacy_credentials_t *legacy_pointer = NULL;
|
||||
if (web_security_error == ESP_OK &&
|
||||
web_security_show_credentials(&legacy_credentials) == ESP_OK) {
|
||||
legacy = (user_database_legacy_credentials_t){
|
||||
.username = (const uint8_t *)legacy_credentials.username,
|
||||
.username_length = legacy_credentials.username_length,
|
||||
.password = (const uint8_t *)legacy_credentials.password,
|
||||
.password_length = legacy_credentials.password_length,
|
||||
};
|
||||
legacy_pointer = &legacy;
|
||||
}
|
||||
esp_err_t user_database_error =
|
||||
user_database_init(legacy_pointer, &user_database_source);
|
||||
secure_wipe(&legacy_credentials, sizeof(legacy_credentials));
|
||||
secure_wipe(&legacy, sizeof(legacy));
|
||||
esp_err_t user_database_error = user_database_init(&user_database_source);
|
||||
if (user_database_error != ESP_OK) {
|
||||
ESP_LOGE(TAG, "User database unavailable: %s; HTTPS and SSH authentication will fail closed; use UART0 'user recover --force'",
|
||||
esp_err_to_name(user_database_error));
|
||||
@@ -162,9 +147,7 @@ void app_main(void)
|
||||
ESP_LOGI(TAG, "Using %s user database",
|
||||
user_database_source == USER_DATABASE_LOAD_STORED
|
||||
? "stored"
|
||||
: (user_database_source == USER_DATABASE_LOAD_MIGRATED_LEGACY
|
||||
? "newly migrated user-level"
|
||||
: "new empty"));
|
||||
: "new empty");
|
||||
}
|
||||
|
||||
esp_err_t web_runtime_error = web_server_init();
|
||||
@@ -267,8 +250,8 @@ void app_main(void)
|
||||
ESP_LOGI(TAG, "Authenticated HTTPS listening on TCP port 443");
|
||||
}
|
||||
}
|
||||
if (wifi_error == ESP_OK && web_security_error == ESP_OK &&
|
||||
ssh_security_error == ESP_OK && ssh_runtime_error == ESP_OK) {
|
||||
if (wifi_error == ESP_OK && ssh_security_error == ESP_OK &&
|
||||
ssh_runtime_error == ESP_OK) {
|
||||
esp_err_t start_error = ssh_transport_start();
|
||||
if (start_error != ESP_OK) {
|
||||
ESP_LOGE(TAG, "SSH startup failed: %s; UART0 recovery remains available",
|
||||
|
||||
Reference in New Issue
Block a user