Skip to content
Merged
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
7 changes: 1 addition & 6 deletions openframe/openframe_token_refresher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ void OpenframeTokenRefresher::stop() {
}

void OpenframeTokenRefresher::process() {
LOG(INFO) << "Starting token refresh process...";

try {
auto new_token = extractor_->extractToken();
if (new_token.empty()) {
Expand All @@ -60,11 +58,8 @@ void OpenframeTokenRefresher::process() {
auto current_token = auth_manager.getToken();

if (new_token != current_token) {
LOG(INFO) << "Token has changed, updating authorization manager";
auth_manager.updateToken(new_token);
LOG(INFO) << "Token successfully updated";
} else {
LOG(INFO) << "Token is up to date, no update needed";
LOG(INFO) << "Openframe token refreshed";
}
} catch (const std::exception& e) {
LOG(ERROR) << "Error during token refresh: " << e.what();
Expand Down
8 changes: 2 additions & 6 deletions osquery/core/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,26 +218,22 @@ void initOpenFrame() {
}

try {
// Create encryption service
// Create openframe token services
auto encryption_service = std::make_shared<OpenframeEncryptionService>(FLAGS_openframe_secret);

// Create token extractor with encryption service
auto token_extractor = std::make_shared<OpenframeTokenExtractor>(encryption_service, FLAGS_openframe_token_path);

// Get initial token and set it in authorization manager
auto initial_token = token_extractor->extractToken();
if (!initial_token.empty()) {
auto& auth_manager = OpenframeAuthorizationManagerProvider::getInstance();
auth_manager.updateToken(initial_token);
VLOG(1) << "Initial OpenFrame token set from token file";
LOG(INFO) << "OpenFrame token extracted successfully";
} else {
LOG(ERROR) << "Failed to get initial token from token file";
}

// Create and start token refresher
static auto token_refresher = std::make_shared<OpenframeTokenRefresher>(token_extractor);
token_refresher->start();
VLOG(1) << "OpenFrame token refresher started";
} catch (const std::exception& e) {
LOG(ERROR) << "Failed to initialize OpenFrame components: " << e.what();
}
Expand Down
5 changes: 0 additions & 5 deletions osquery/remote/transports/tls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,10 @@ void TLSTransport::decorateRequest(http::Request& r) {
r << http::Request::Header("User-Agent", kTLSUserAgentBase + kVersion);

if (FLAGS_openframe_mode) {
LOG(INFO) << "Adding Authorization header with Bearer token for openframe mode";
auto& auth_manager = OpenframeAuthorizationManagerProvider::getInstance();
std::string token = auth_manager.getToken();
if (!token.empty()) {
r << http::Request::Header("Authorization", "Bearer " + token);
LOG(INFO) << "Token added to request";
} else {
LOG(ERROR) << "No token found in memory";
}
}
}
Expand All @@ -116,7 +112,6 @@ http::Client::Options TLSTransport::getOptions() {
options.follow_redirects(true).timeout(16);

if (FLAGS_openframe_mode) {
LOG(INFO) << "Disable SSL verification for openframe mode";
options.always_verify_peer(false);
return options;
}
Expand Down
1 change: 0 additions & 1 deletion osquery/remote/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class TLSRequestHelper : private boost::noncopyable {

// Add the prefix "/tools/agent/fleetmdm-server" to all requests only if openframe mode is enabled
if (FLAGS_openframe_mode) {
LOG(INFO) << "Adding /tools/agent/fleetmdm-server to URI for openframe mode";
uri += "/tools/agent/fleetmdm-server";
}

Expand Down
1 change: 0 additions & 1 deletion plugins/remote/enroll/tls_enroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ std::string TLSEnrollPlugin::enroll() {

// Add the prefix "/tools/agent/fleetmdm-server" to all requests only if openframe mode is enabled
if (FLAGS_openframe_mode) {
LOG(INFO) << "Adding /tools/agent/fleetmdm-server to URI for openframe mode";
uri += "/tools/agent/fleetmdm-server";
}

Expand Down
Loading