forked from canonical/Fast-RTPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Security Logging Plugin. (eProsima#1125)
* Add security logging (canonical#1) * add security logging to file as per dds-spec * add set/get logger to security plugin base classes * logging integration to SecurityManager * add SECURITY_LOGGING macros Signed-off-by: artivis <jeremie.deray@canonical.com> * handle empty filename Signed-off-by: artivis <jeremie.deray@canonical.com> * post-master-merge fix Signed-off-by: artivis <jeremie.deray@canonical.com> * handle empty filename Signed-off-by: artivis <jeremie.deray@canonical.com> * fix typo test filename Signed-off-by: artivis <jeremie.deray@canonical.com> * fix linking error * some doc fixes Signed-off-by: artivis <jeremie.deray@canonical.com> * some doc fixes Signed-off-by: artivis <jeremie.deray@canonical.com> * support logging in SecurityPluginFactory Mock Signed-off-by: artivis <jeremie.deray@canonical.com> * include log in security logging for macro support & cleanup Signed-off-by: artivis <jeremie.deray@canonical.com> * add missing source Signed-off-by: artivis <jeremie.deray@canonical.com> * replace 'library' includes with 'system' Signed-off-by: artivis <jeremie.deray@canonical.com> * uncrustify Signed-off-by: artivis <jeremie.deray@canonical.com> * add log to file test Signed-off-by: artivis <jeremie.deray@canonical.com> * fix warnings Signed-off-by: artivis <jeremie.deray@canonical.com> * fix error msg typo Signed-off-by: artivis <jeremie.deray@canonical.com> * fix linking error Signed-off-by: artivis <jeremie.deray@canonical.com> * fix warning Signed-off-by: artivis <jeremie.deray@canonical.com> * add verbosity level to file logs Signed-off-by: artivis <jeremie.deray@canonical.com> * test file logs header Signed-off-by: artivis <jeremie.deray@canonical.com> * use logging in Permission Signed-off-by: artivis <jeremie.deray@canonical.com> * use logging in PKIDH Signed-off-by: artivis <jeremie.deray@canonical.com> * use logging in SecurityManager Signed-off-by: artivis <jeremie.deray@canonical.com>
- Loading branch information
Showing
27 changed files
with
1,729 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
include/fastdds/rtps/security/logging/BuiltinLoggingType.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2020 Canonical ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/*! | ||
* @file BuiltinLoggingType.h | ||
*/ | ||
#ifndef _FASTDDS_RTPS_SECURITY_LOGGING_BUILTINLOGGINGTYPE_H_ | ||
#define _FASTDDS_RTPS_SECURITY_LOGGING_BUILTINLOGGINGTYPE_H_ | ||
|
||
#include <fastdds/rtps/common/Types.h> | ||
#include <fastdds/rtps/common/Time_t.h> | ||
#include <fastdds/rtps/security/logging/LoggingLevel.h> | ||
#include <fastdds/rtps/security/logging/NameValuePair.h> | ||
|
||
#include <map> | ||
|
||
namespace eprosima { | ||
namespace fastrtps { | ||
namespace rtps { | ||
namespace security { | ||
|
||
/** | ||
* @brief The BuiltinLoggingType struct | ||
* | ||
* @note Definition in DDS-Sec v1.1 9.6 | ||
*/ | ||
struct BuiltinLoggingType final | ||
{ | ||
octet facility; // Set to 0x0A (10). Indicates sec/auth msgs | ||
LoggingLevel severity; | ||
rtps::Time_t timestamp; // Since epoch 1970-01-01 00:00:00 +0000 (UTC) | ||
std::string hostname; // IP host name of originator | ||
std::string hostip; // IP address of originator | ||
std::string appname; // Identify the device or application | ||
std::string procid; // Process name/ID for syslog system | ||
std::string msgid; // Identify the type of message | ||
std::string message; // Free-form message | ||
// Note that certain string keys (SD-IDs) are reserved by IANA | ||
std::map<std::string, NameValuePairSeq> structured_data; | ||
}; | ||
|
||
} //namespace security | ||
} //namespace rtps | ||
} //namespace fastrtps | ||
} //namespace eprosima | ||
|
||
#endif // _FASTDDS_RTPS_SECURITY_LOGGING_BUILTINLOGGINGTYPE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2020 Canonical ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/*! | ||
* @file LogOptions.h | ||
*/ | ||
#ifndef _FASTDDS_RTPS_SECURITY_LOGGING_LOGOPTIONS_H_ | ||
#define _FASTDDS_RTPS_SECURITY_LOGGING_LOGOPTIONS_H_ | ||
|
||
#include <string> | ||
|
||
#include <fastdds/rtps/security/logging/LoggingLevel.h> | ||
|
||
namespace eprosima { | ||
namespace fastrtps { | ||
namespace rtps { | ||
namespace security { | ||
|
||
/** | ||
* @brief The LogOptions struct | ||
* @note Definition in DDS-Sec v1.1 8.6.2.1 | ||
*/ | ||
struct LogOptions | ||
{ | ||
//! Whether the log events should be distributed over DDS | ||
bool distribute; | ||
|
||
//! Level at which log messages will be logged. | ||
//! Messages at or below the log_level are logged. | ||
LoggingLevel log_level; | ||
|
||
//! Full path to a local file | ||
std::string log_file; | ||
}; | ||
|
||
} //namespace security | ||
} //namespace rtps | ||
} //namespace fastrtps | ||
} //namespace eprosima | ||
|
||
#endif // _FASTDDS_RTPS_SECURITY_LOGGING_LOGOPTIONS_H_ |
Oops, something went wrong.