Add config entry to check application

This commit is contained in:
Bartosz Wieczorek 2025-06-12 13:11:44 +02:00
parent 5d163800c3
commit 29890305c6
3 changed files with 10 additions and 4 deletions

View File

@ -55,6 +55,7 @@ class Status {
std::string_view _appTypeKey = "/type"; std::string_view _appTypeKey = "/type";
std::string_view _paramSystemName = "/params/os"; std::string_view _paramSystemName = "/params/os";
std::string_view _paramSSHDBase = "/params/sshd_config/"; std::string_view _paramSSHDBase = "/params/sshd_config/";
std::string_view _configBase = "/config/";
public: public:
Status() : _alloc{}, _data{&_alloc}, _statusUpdated{false} { Status() : _alloc{}, _data{&_alloc}, _statusUpdated{false} {
@ -95,7 +96,7 @@ class Status {
void updateSSHDConfig() { void updateSSHDConfig() {
using namespace std::string_view_literals; using namespace std::string_view_literals;
constexpr auto keys = make_array<std::string_view>("authenticationmethods"sv, constexpr auto keys = make_array< std::string_view >("authenticationmethods"sv,
"challengeresponseauthentication"sv, "challengeresponseauthentication"sv,
"kbdinteractiveauthentication"sv, "kbdinteractiveauthentication"sv,
"logingracetime"sv, "logingracetime"sv,
@ -171,7 +172,7 @@ class CheckApplication {
public: public:
tl::expected< int, Error > call(const CoreHandler_t & coreHandler, std::string_view systemToken) const { tl::expected< int, Error > call(const CoreHandler_t & coreHandler, std::string_view systemToken) const {
memory::MonotonicStack_1k_Resource mr; memory::MonotonicStack_2k_Resource mr;
RapidJSONPMRAlloc alloc{&mr}; RapidJSONPMRAlloc alloc{&mr};
constexpr std::string_view api = "/api/app/init"; constexpr std::string_view api = "/api/app/init";
Status status; Status status;
@ -181,6 +182,7 @@ class CheckApplication {
status.updateAppVersion(RUBLON_VERSION_STRING); status.updateAppVersion(RUBLON_VERSION_STRING);
status.updateSystemVersion(details::osName(&mr)); status.updateSystemVersion(details::osName(&mr));
status.updateSSHDConfig(); status.updateSSHDConfig();
status.updateRublonConfig();
if(status.updated()) { if(status.updated()) {
auto & alloc = status.data().GetAllocator(); auto & alloc = status.data().GetAllocator();

View File

@ -60,7 +60,7 @@ class Init : public AuthenticationStep {
params.AddMember("appVer", RUBLON_VERSION_STRING, alloc); params.AddMember("appVer", RUBLON_VERSION_STRING, alloc);
if(not host.empty()) if(not host.empty())
params.AddMember("hostName", Value{os.c_str(), static_cast< unsigned >(host.size()), alloc}, alloc); params.AddMember("hostName", Value{os.c_str(), static_cast< unsigned >(host.size()), alloc}, alloc);
if(not _session.inInteractiveMode()) if(_session.inNonInteractiveMode())
params.AddMember("mode", "noninteractive", alloc); params.AddMember("mode", "noninteractive", alloc);
params.AddMember("os", Value{os.c_str(), static_cast< unsigned >(os.size()), alloc}, alloc); params.AddMember("os", Value{os.c_str(), static_cast< unsigned >(os.size()), alloc}, alloc);
params.AddMember("userIP", Value{pam.ip().get(), alloc}, alloc); params.AddMember("userIP", Value{pam.ip().get(), alloc}, alloc);

View File

@ -130,7 +130,11 @@ class Session : public DefaultResource {
return systemToken().data(); return systemToken().data();
} }
bool inInteractiveMode() const { constexpr bool inNonInteractiveMode() const {
return not inInteractiveMode();
}
constexpr bool inInteractiveMode() const {
return _config.nonInteractiveMode == false; return _config.nonInteractiveMode == false;
} }