Support TLS CN authentication and per-image permissions in vitastor-cli serve

This commit is contained in:
Vitaliy Filippov
2026-04-27 15:24:44 +03:00
parent 340849248b
commit a21dcd4480
12 changed files with 214 additions and 36 deletions
+9
View File
@@ -262,6 +262,7 @@ void etcd_state_client_t::parse_config(const json11::Json & config)
}
this->etcd_ca = config["etcd_ca"].string_value();
this->etcd_prefix = config["etcd_prefix"].string_value();
this->use_auth = config["use_auth"].bool_value();
if (this->etcd_prefix == "")
{
this->etcd_prefix = "/vitastor";
@@ -1353,6 +1354,14 @@ void etcd_state_client_t::parse_state(const etcd_kv_t & kv)
if (on_change_node_placement_hook)
on_change_node_placement_hook();
}
else if (use_auth && key.substr(0, etcd_prefix.length()+13) == etcd_prefix+"/config/user/")
{
// <etcd_prefix>/config/user/<username>
if (!value.is_object())
user_info.erase(key.substr(etcd_prefix.length()+13));
else
user_info[key.substr(etcd_prefix.length()+13)] = value;
}
}
uint32_t etcd_state_client_t::parse_immediate_commit(const std::string & immediate_commit_str, uint32_t default_value)