Description files in the Secure Logger example

Entity descriptions

The Application and LogViewer entities do not provide functionality to other entities.

Application.edl

entity secure_logger.Application

LogViewer.edl

entity secure_logger.LogViewer

The Logger entity provides functionality for writing logs to storage and contains an implementation of the Write interface, which contains the WriteInLog() method for adding an entry to the log.

Logger.edl

entity secure_logger.Logger

interfaces

{

write : secure_logger.Write

}

Write.idl

package secure_logger.Write

const UInt32 MaxLogMessageSize = 512;

const UInt32 MaxLogMessageCount = 1;

typedef sequence<UInt8, MaxLogMessageSize> MsgString;

typedef array<MsgString, MaxLogMessageCount> Message;

interface

{

WriteInLog(in Message message);

}

The Reader entity provides functionality for reading logs from storage and contains an implementation of the Read interface, which contains the ReadFromLog() method for reading a log entry, and an implementation of the GetLastIndex interface, which contains the GetLogLastIndex() method for receiving the index of the last log entry.

Reader.edl

entity secure_logger.Reader

interfaces

{

read : secure_logger.Read

getLastIndex : secure_logger.GetLastIndex

}

Read.idl

package secure_logger.Read

const UInt32 MaxLogMessageSize = 512;

const UInt32 MaxLogMessageCount = 100;

typedef sequence<UInt8, MaxLogMessageSize> MsgString;

typedef sequence<MsgString, MaxLogMessageCount> MsgList;

struct LogRequest

{

UInt64 startIndex;

UInt64 endIndex;

}

interface

{

ReadFromLog(in LogRequest logReq, out MsgList logRes);

}

GetLastIndex.idl

package secure_logger.GetLastIndex

interface

{

GetLogLastIndex(out UInt64 logLastIndex);

}

Init description

init.yaml

entities:

- name: secure_logger.Application

connections:

- target: secure_logger.Logger

id: logger_connection

- name: secure_logger.LogViewer

connections:

- target: secure_logger.Reader

id: reader_connection

- name: secure_logger.Logger

connections:

- target: kl.VfsEntity

id: {var: _VFS_CONNECTION_ID, include: vfs/defs.h}

- name: secure_logger.Reader

connections:

- target: kl.VfsEntity

id: {var: _VFS_CONNECTION_ID, include: vfs/defs.h}

- name: kl.VfsEntity

path: VFS

connections:

- target: kl.drivers.PCIE

id: kl.drivers.PCIE

- name: kl.drivers.PCIE

path: pcie_hw

Solution security policy

security.psl

execute: kl.core.Execute

use nk.base._

use trusted._

/**

* This code includes EDL descriptions of corresponding non-platform

* untrusted entities.

*/

use EDL secure_logger.Logger

use EDL secure_logger.Reader

use EDL secure_logger.Application

use EDL secure_logger.LogViewer

/**

* The following code lets you send requests from untrusted entities to the KasperskyOS kernel

* and receive responses. It makes it possible for untrusted entities to use system calls.

* Caution! This rule is strictly for early-stage development because it

* exposes a variety of system services that could be invoked by an attacker.

* An audit must be performed to determine the minimal set of methods to allow.

*/

request src=secure_logger.Logger, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=secure_logger.Logger

{

grant()

}

request src=secure_logger.Reader, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=secure_logger.Reader

{

grant()

}

request src=secure_logger.Application, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=secure_logger.Application

{

grant()

}

request src=secure_logger.LogViewer, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=secure_logger.LogViewer

{

grant()

}

/**

* The following code lets untrusted entities send requests to kl.VfsEntity

* and receive responses. It makes it possible for system calls related to the file

* system to be used by untrusted entities.

*/

request src=secure_logger.Reader, dst=kl.VfsEntity

{

grant()

}

response src=kl.VfsEntity, dst=secure_logger.Reader

{

grant()

}

request src=secure_logger.Logger, dst=kl.VfsEntity

{

grant()

}

response src=kl.VfsEntity, dst=secure_logger.Logger

{

grant()

}

/**

* The following code enables interactions between untrusted entities.

*/

request src=secure_logger.Application, dst=secure_logger.Logger, interface=secure_logger.Write, method=WriteInLog

{

grant()

}

response src=secure_logger.Logger, dst=secure_logger.Application, interface=secure_logger.Write, method=WriteInLog

{

grant()

}

request src=secure_logger.LogViewer, dst=secure_logger.Reader, interface=secure_logger.Read, method=ReadFromLog

{

grant()

}

response src=secure_logger.Reader, dst=secure_logger.LogViewer, interface=secure_logger.Read, method=ReadFromLog

{

grant()

}

request src=secure_logger.LogViewer, dst=secure_logger.Reader, interface=secure_logger.GetLastIndex, method=GetLogLastIndex

{

grant()

}

response src=secure_logger.Reader, dst=secure_logger.LogViewer, interface=secure_logger.GetLastIndex, method=GetLogLastIndex

{

grant()

}

trusted.psl

/**

* This file describes trusted platform entities and their connections.

*/

/**

* This code includes EDL descriptions of corresponding platform entities.

*/

use EDL kl.core.Core

use EDL kl.VfsEntity

use EDL kl.drivers.PCIE

use EDL Einit

/**

* This statement lets the KasperskyOS kernel start system entities.

*/

execute src=kl.core.Core, dst=kl.core.Core

{

grant()

}

execute src=kl.core.Core, dst=Einit

{

grant()

}

/**

* This statement lets you start up and initialize non-platform entities.

*/

execute src=Einit

{

grant()

}

/**

* This code lets you send requests from the Einit entity to the KasperskyOS kernel and receive

* responses. It makes it possible for Einit to use system calls.

*/

request src=Einit, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=Einit

{

grant()

}

/**

* This code lets the kl.VfsEntity entity (system VFS

* driver implementation) send requests to the KasperskyOS kernel and receive responses. It allows

* system calls by kl.VfsEntity.

*/

request src=kl.VfsEntity, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=kl.VfsEntity

{

grant()

}

/**

* This code lets the kl.drivers.PCIE entity (system PCIE

* driver implementation) send requests to the KasperskyOS kernel and receive responses. It allows the use of

* system calls by kl.drivers.PCIE.

*/

request src=kl.drivers.PCIE, dst=kl.core.Core

{

grant()

}

response src=kl.core.Core, dst=kl.drivers.PCIE

{

grant()

}

Page top