Config: Added [allowed_keys] section for client public key authorization on server
- Added CFG_ALLOWED_KEY struct with binary key storage (64 bytes) for fast memcmp comparison - Implemented parsing of [allowed_keys] section with allow_all flag and per-key entries - Added key validation in etcp_connections.c server handler (errorcode=8 for rejected keys) - Default behavior: deny all if [allowed_keys] section is missing or allow_all=0 with no keys - Added proper memory cleanup and debug logging for allowed_keys configuration - Updated all test configs to include [allowed_keys] allow_all=1 for backward compatibility
This commit is contained in:
1 parent
3625a4e5d5
commit
e39979bfac
12 files changed
+131
-10
No files matched your search
@@ -5,6 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "../lib/platform_compat.h"
|
||||
#include "secure_channel.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -72,6 +73,11 @@ struct CFG_CONTROL_ALLOW {
|
||||
uint32_t netmask; // netmask in host byte order (e.g. 0xffffff00 for /24)
|
||||
};
|
||||
|
||||
struct CFG_ALLOWED_KEY {
|
||||
uint8_t key_bin[SC_PUBKEY_SIZE]; // public key in binary (64 bytes)
|
||||
struct CFG_ALLOWED_KEY *next;
|
||||
};
|
||||
|
||||
struct global_config {
|
||||
char name[16]; // Instance name
|
||||
char my_private_key_hex[MAX_KEY_LEN];
|
||||
@@ -110,6 +116,11 @@ struct global_config {
|
||||
// Control server configuration ([control] section)
|
||||
struct CFG_CONTROL_ALLOW *control_allows;
|
||||
int control_allow_count;
|
||||
|
||||
// Allowed keys configuration ([allowed_keys] section)
|
||||
struct CFG_ALLOWED_KEY *allowed_keys;
|
||||
int allowed_keys_count;
|
||||
int allowed_keys_allow_all;
|
||||
};
|
||||
|
||||
struct utun_config {
|
||||
|
||||
Reference in new issue
Block a user