Add security access and audit interfaces
This commit is contained in:
@@ -126,6 +126,8 @@ list(APPEND XTOSKRNL_SOURCE
|
||||
${XTOSKRNL_SOURCE_DIR}/rtl/time.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/rtl/unicode.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/rtl/widestr.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/se/access.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/se/audit.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/se/descript.cc
|
||||
${XTOSKRNL_SOURCE_DIR}/se/privileg.cc)
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
#include <se/access.hh>
|
||||
#include <se/audit.hh>
|
||||
#include <se/descript.hh>
|
||||
#include <se/privileg.hh>
|
||||
|
||||
|
||||
28
xtoskrnl/includes/se/access.hh
Normal file
28
xtoskrnl/includes/se/access.hh
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/se/access.hh
|
||||
* DESCRIPTION: Security access state check routines
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_SE_ACCESS_HH
|
||||
#define __XTOSKRNL_SE_ACCESS_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Kernel Security */
|
||||
namespace SE
|
||||
{
|
||||
class Access
|
||||
{
|
||||
public:
|
||||
STATIC XTFASTCALL ACCESS_MASK ComputeDeniedAccesses(IN ACCESS_MASK GrantedAccess,
|
||||
IN ACCESS_MASK DesiredAccess);
|
||||
STATIC XTFASTCALL ACCESS_MASK ComputeGrantedAccesses(IN ACCESS_MASK GrantedAccess,
|
||||
IN ACCESS_MASK DesiredAccess);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_SE_ACCESS_HH */
|
||||
29
xtoskrnl/includes/se/audit.hh
Normal file
29
xtoskrnl/includes/se/audit.hh
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/se/audit.hh
|
||||
* DESCRIPTION: Security Auditing
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_SE_AUDIT_HH
|
||||
#define __XTOSKRNL_SE_AUDIT_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Kernel Security */
|
||||
namespace SE
|
||||
{
|
||||
class Audit
|
||||
{
|
||||
public:
|
||||
STATIC XTAPI VOID OperationAuditAlarm(IN PUNICODE_STRING SubsystemName,
|
||||
IN PVOID HandleId,
|
||||
IN PUNICODE_STRING ObjectTypeName,
|
||||
IN ACCESS_MASK AccessMask,
|
||||
IN PSID UserSid);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_SE_AUDIT_HH */
|
||||
@@ -28,7 +28,7 @@ namespace SE
|
||||
OUT PULONG QuotaSize);
|
||||
STATIC XTAPI VOID ReleaseSecurityDescriptor(IN PSECURITY_DESCRIPTOR Descriptor,
|
||||
IN KPROCESSOR_MODE ProcessorMode,
|
||||
IN BOOLEAN ForceRelease);
|
||||
IN BOOLEAN Force);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
54
xtoskrnl/se/access.cc
Normal file
54
xtoskrnl/se/access.cc
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/se/access.cc
|
||||
* DESCRIPTION: Security access state check routines
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
* Computes the access rights that are requested but not granted.
|
||||
*
|
||||
* @param GrantedAccessMask
|
||||
* Supplies the mask of access rights currently granted to the subject.
|
||||
*
|
||||
* @param DesiredAccessMask
|
||||
* Supplies the mask of access rights requested by the subject.
|
||||
*
|
||||
* @return This routine returns an access mask with the bits in DesiredAccess that are not present in GrantedAccess.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTFASTCALL
|
||||
ACCESS_MASK
|
||||
SE::Access::ComputeDeniedAccesses(IN ACCESS_MASK GrantedAccessMask,
|
||||
IN ACCESS_MASK DesiredAccessMask)
|
||||
{
|
||||
/* Return the desired denied accesses */
|
||||
return ~GrantedAccessMask & DesiredAccessMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the access rights that are both requested and granted.
|
||||
*
|
||||
* @param GrantedAccessMask
|
||||
* Supplies the mask of access rights currently granted to the subject.
|
||||
*
|
||||
* @param DesiredAccessMask
|
||||
* Supplies the mask of access rights requested by the subject.
|
||||
*
|
||||
* @return This routine returns an access mask containing the intersection of DesiredAccess and GrantedAccess bits.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTFASTCALL
|
||||
ACCESS_MASK
|
||||
SE::Access::ComputeGrantedAccesses(IN ACCESS_MASK GrantedAccessMask,
|
||||
IN ACCESS_MASK DesiredAccessMask)
|
||||
{
|
||||
/* Return the desired granted accesses */
|
||||
return GrantedAccessMask & DesiredAccessMask;
|
||||
}
|
||||
43
xtoskrnl/se/audit.cc
Normal file
43
xtoskrnl/se/audit.cc
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/se/audit.cc
|
||||
* DESCRIPTION: Security Auditing
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
* Generates a security audit alarm for an object access operation.
|
||||
*
|
||||
* @param SubsystemName
|
||||
* Supplies the name of the subsystem triggering the audit alarm.
|
||||
*
|
||||
* @param HandleId
|
||||
* Supplies the handle or identifier of the object being accessed.
|
||||
*
|
||||
* @param ObjectTypeName
|
||||
* Supplies the name of the object type being accessed.
|
||||
*
|
||||
* @param AccessMask
|
||||
* Supplies the access mask containing the specific rights that triggered the audit.
|
||||
*
|
||||
* @param UserSid
|
||||
* Optionally supplies the SID of the user initiating the operation.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTAPI
|
||||
VOID
|
||||
SE::Audit::OperationAuditAlarm(IN PUNICODE_STRING SubsystemName,
|
||||
IN PVOID HandleId,
|
||||
IN PUNICODE_STRING ObjectTypeName,
|
||||
IN ACCESS_MASK AccessMask,
|
||||
IN PSID UserSid)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ SE::Descriptor::ComputeQuotaInformationSize(IN PSECURITY_DESCRIPTOR SecurityDesc
|
||||
* @param ProcessorMode
|
||||
* Supplies the processor mode that was originally used to capture the descriptor.
|
||||
*
|
||||
* @param ForceRelease
|
||||
* @param Force
|
||||
* Supplies a boolean value indicating whether to force the deallocation.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
@@ -112,10 +112,10 @@ XTAPI
|
||||
VOID
|
||||
SE::Descriptor::ReleaseSecurityDescriptor(IN PSECURITY_DESCRIPTOR Descriptor,
|
||||
IN KPROCESSOR_MODE ProcessorMode,
|
||||
IN BOOLEAN ForceRelease)
|
||||
IN BOOLEAN Force)
|
||||
{
|
||||
/* Check if the descriptor should be released */
|
||||
if(((ProcessorMode == KernelMode) && (ForceRelease == TRUE)) || (ProcessorMode == UserMode))
|
||||
if(((ProcessorMode == KernelMode) && (Force == TRUE)) || (ProcessorMode == UserMode))
|
||||
{
|
||||
/* Ensure the descriptor is valid */
|
||||
if(Descriptor)
|
||||
|
||||
Reference in New Issue
Block a user