Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log AP manager events and WPA events to audit log #312

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/common/net/wifi/apmanager/AccessPointManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <utility>
#include <vector>

#include <logging/LogUtils.hxx>
#include <magic_enum.hpp>
#include <microsoft/net/wifi/AccessPointDiscoveryAgent.hxx>
#include <microsoft/net/wifi/AccessPointManager.hxx>
Expand Down Expand Up @@ -40,6 +41,7 @@ AccessPointManager::AddAccessPoint(std::shared_ptr<IAccessPoint> accessPoint)
{
const auto interfaceName{ accessPoint->GetInterfaceName() };
LOGI << std::format("Attempting to add access point {} to manager", interfaceName);
AUDIT_LOGD << std::format("Attempting to add access point {} to manager", interfaceName);

{
auto accessPointController = accessPoint->CreateController();
Expand All @@ -60,6 +62,7 @@ AccessPointManager::AddAccessPoint(std::shared_ptr<IAccessPoint> accessPoint)
}

LOGI << std::format("Adding access point {} to manager", interfaceName);
AUDIT_LOGI << std::format("Adding access point {} to manager", interfaceName);

m_accessPoints.push_back(std::move(accessPoint));
}
Expand All @@ -69,6 +72,7 @@ AccessPointManager::RemoveAccessPoint(std::shared_ptr<IAccessPoint> accessPoint)
{
const auto interfaceName{ accessPoint->GetInterfaceName() };
LOGI << std::format("Attempting to remove access point {} from manager", interfaceName);
AUDIT_LOGD << std::format("Attempting to remove access point {} from manager", interfaceName);

const auto accessPointsLock = std::scoped_lock{ m_accessPointGate };
const auto accessPointToRemove = std::ranges::find_if(m_accessPoints, [&](const auto& accessPointExisting) {
Expand All @@ -81,6 +85,7 @@ AccessPointManager::RemoveAccessPoint(std::shared_ptr<IAccessPoint> accessPoint)
}

LOGI << std::format("Removing access point {} from manager", interfaceName);
AUDIT_LOGI << std::format("Removing access point {} from manager", interfaceName);

m_accessPoints.erase(accessPointToRemove);
}
Expand Down
1 change: 1 addition & 0 deletions src/common/net/wifi/apmanager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ target_link_libraries(wifi-apmanager
plog::plog
PUBLIC
${PROJECT_NAME}-protocol
logging-utils
wifi-core
)

Expand Down
1 change: 1 addition & 0 deletions src/linux/net/wifi/wpa-controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ target_sources(wpa-controller
target_link_libraries(wpa-controller
PUBLIC
libwpa-client
logging-utils
notstd
wifi-core
PRIVATE
Expand Down
2 changes: 2 additions & 0 deletions src/linux/net/wifi/wpa-controller/Hostapd.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <Wpa/WpaCore.hxx>
#include <Wpa/WpaResponseGetConfig.hxx>
#include <Wpa/WpaResponseStatus.hxx>
#include <logging/LogUtils.hxx>
#include <magic_enum.hpp>
#include <microsoft/net/wifi/Ieee80211.hxx>
#include <plog/Log.h>
Expand Down Expand Up @@ -553,4 +554,5 @@ Hostapd::OnWpaEvent(WpaEventSender* sender, const WpaEventArgs* eventArgs)
{
const auto& event{ eventArgs->Event };
LOGD << std::format("> [{}-Event|{}|{}|Sender={:#08x}] {}", magic_enum::enum_name(event.Source), magic_enum::enum_name(event.LogLevel), eventArgs->Timestamp, reinterpret_cast<uintptr_t>(sender), event.Payload);
AUDIT_LOGI << std::format("> [{}-Event|{}|{}|Sender={:#08x}] {}", magic_enum::enum_name(event.Source), magic_enum::enum_name(event.LogLevel), eventArgs->Timestamp, reinterpret_cast<uintptr_t>(sender), event.Payload);
}