Giter Club home page Giter Club logo

dct's Introduction

Defined-trust Communications Toolkit (DCT)

This repository contains Pollere's evolving work on tools, libraries, defined-trust transport (DeftT), and proof-of-concept applications for the Defined-trust Communications (DC) framework. DC enables fine-grained non-perimeter-based trust domains and DeftT is a collection-based transport efficient on broadcast media. DeftT provides default deny networking for closed communities with dynamic membership. DCT grew out of our own work, so reflects the needs of Pollere and clients, but the toolkit may prove useful to others and the repo provides a reference implementation of DeftT. DCT aims to reduce the amount of installed code needed to write secure applications and to enable and enforce defined-trust applications: applications don't "do" security, the transport does.

Defined-trust Communications is influenced by a number of relatively recent advances: LangSec, Set Reconciliation, Trust Schemas, Information-Centric Networking and the deployment of IPv6 with its multicast support. Operational Technologies like IoT and DER are its current focus. Why "defined-trust"? Langsec (langsec.org) "posits that the only path to trustworthy software that takes untrusted inputs is treating all valid or expected inputs as a formal language, and the respective input-handling routines as a recognizer for that language." In a 2016 paper, the Langsec Project authors note that the "robustness principle" of "be liberal in what you accept" should be replaced with "be definite in what you accept" and DCT provides the means to implement such an approach in a communication schema, tools and a run-time library for the DeftT protocol. DC provides a new way to implement and enforce secure communications policies on networks.

Information movement is according to trust rules, expressed in verifiable schemas. DeftT's default interface is broadcast media-friendly, using a multi-party collection-based transport and self-configuring UDP/IPv6 multicast. The examples/relay subdirectory contains examples of connecting different subnets and use of a unicast interface.

Our current target use is creating secure communication domains for OT for which we developed DeftT. A trust domain is characterized by a particular signed set of communication rules used by DeftT. The trust domain owner generates a trust anchor and all the certificates specified by the rules, including the choin-of-trust identities for use by each entity that can join the trust domain (tools for this and examples are provided). All certificates' signing chains, including a compact binary representation of the rules, terminate at the same trust anchor. An entity's identity chain includes the private key of its leaf identity cert and the public certs of its entire chain-of-trust terminating at the trust anchor. This identity is bundled with the trust anchor and the signed schema, and configured in each enrolled entity, the private identity key being securely configured. In operation, this ensures a zero-trust domain for all the communications between the enrolled entities. More information is contained in subdirectory Readmes and the references included below.

DCT initially used a modified and restricted version of the Interest-Data semantics developed by the NDN project (named-data.net) and its current packet formats (cStates, cAdds, Publications) are evolved from NDN's packet format but are no longer compatible. DCT does not use an NDN Forwarder or NDN libraries. The only library DCT requires is the libsodium library.

Defined-trust Communications comprises elements that may be used separately, e.g., the model of securing data could be separated from the syncps protocol and syncps could be used without a trust management engine.

The version 10 release implements suppression of excess cStates and cAdds on a broadcast channel. It also adds a change to the cAdd format where only a hash of the associated cState iblt is used for increased efficiency. Version 10.2 adds support for self-configuring mesh communications even when a subnet is only partially connected. This can be tested on an actual topology that is not fully connected and/or using a simple hack we've made available if you are using a fully connected subnet. The examples/robust directory explains how to do this.

Directories

This repository is organized into directories:

  • tools: contains tools for creating the schemas and certs needed by a DCT-enabled application (described in its README) and two subdirectories:

    • compiler: description of the VerSec Language for expressing trust rules and source code for schemaCompile that turns the language into a binary schema.

    • dctwatch: a tool that passively listens to the default DCT network interface and prints the packets it sees (helpful in debugging)

  • include/dct: run-time transport modules developed and used by Pollere for DeftT:

    • syncps: the pub-sub sync protocol that maintains collections
    • face: interface between syncps and the system-provided packet transport
    • schema: the run-time library that makes use of the binary schema
    • sigmgrs: supplies a range of signing and validation methods
    • distributors: distribute certs and group keys and manage the associated collections
    • shims: library APIs for DeftT - mbps (message-based pub/sub) and ptps (pass-through pub/sub for relays)
  • examples: this directory contains illustrative examples

Bug reports are welcome.

Installing and building the pieces

All the modules are header-only C++ 'libraries' so the DCT/include tree has to be made available to programs using it via a -I c++ compiler flag or installed in a standard include path like /usr/local/include. The code requires c++20 and compiles with the current xcode compiler or clang-11 on MacOS and Linux and gcc-9 on Linux. It uses the new c++20 formatted output model which, unfortunately, is not yet in either compiler's standard library. To fill that gap we suggest using the excellent implementation available at https://fmt.dev/latest/index.html. This should be installed somewhere on your system and its include/fmt directory symlinked from DCT/include. (This distribution has a copy of the current 8.0.1 fmt dist in DCT/include/fmt; that should be removed and replaced with the symlink.)

The included versec compiler is required to compile new schemas but pre-compiled schemas for the examples are available as a *.scm file in the example source directory. To compile and run an example using the pre-compiled schema, for example, mbps:

  • (one time) install libsodium from https://doc.libsodium.org/ if not already installed
  • (one time) install boost includes (boost.org) if not already installed
  • cd DCT/examples/<*> then make to build the example. If the make is successful, follow the readme to create 'identity bundles' and run it.

References and related work

DeftT is described in an internet draft: https://datatracker.ietf.org/doc/draft-nichols-iotops-defined-trust-transport/ with overview talk at: https://youtu.be/YSmxis1puuE?t=2170 slides at: http://pollere.net/Pdfdocs/slides-114-iotops-defined-trust-transport-00.pdf

Some concepts here may be better understood by referencing earlier Pollere work:

Lessons Learned Building a Secure Network Measurement Framework using Basic NDN , K. Nichols, Proceedings of ACM ICN '19, September 24-16, Macao, China (available at http://www.pollere.net/publications.html)

"Trust schemas and ICN: key to secure home IoT", K. Nichols, Proceedings of ACM ICN '21, September 2021 (available at https://dl.acm.org/doi/10.1145/3460417.3482972)

Related talks at http://www.pollere.net/talks.html

See also GitHub.com/pollere/DNMP-v2 for Pollere's first bespoke transport.

"The Seven Turrets of Babel: A Taxonomy of LangSec Errors and How to Expunge Them" , F. Momot, S. Bratus, S. Hallberg, M. Patterson, IEEE Cybersecurity Development Conference (SecDev), November 2016


Copyright (C) 2021-2024 Pollere LLC

dct's People

Contributors

kmnichols avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dct's Issues

dnmp.trust does not compile

dnmp.trust is using the replace() function that is unimplemented in the current version of the schema compiler.
Consequently, it is not compiling properly.
Please update the schema so that it does not use the replace() function.

$ ./schemaCompile -vv doc/dnmp.trust 
VerSec Schema Compiler Copyright (C) 2020 Pollere Inc., v5.1.0-1-gab45368
doc/dnmp.trust:32.17-24: syntax error, unexpected string, expecting ')'
doc/dnmp.trust:32.35-41: syntax error, unexpected literal, expecting eof or string
Publication #command:
  parameters: target pType pArgs
  tags: /_network/_domain/target/_topic/_roleId/pType/pArgs/_origin/_cTS

Publication #wirePrefix:
  parameters: target
  tags: /_ndnprefix/_domain/target

Certificate templates:
  cert userCert: /"AliceNetOps"/"dnmp"/"user"/_roleId/"KEY"/_/_/_
  cert opCert: /"AliceNetOps"/"dnmp"/"operator"/_roleId/"KEY"/_/_/_
  cert dnmpCert: /"AliceNetOps"/"dnmp"/"KEY"/_/_/_
  cert netCert: /"AliceNetOps"/"KEY"/_/_/_

binary schema  is 354 bytes

sigmgrs: timing attack vulnerability

SigMgrRFC7693::validate and SigMgrSHA256::validate functions verify BLAKE2b or SHA256 signature.
Each function first creates a correct BLAKE2b or SHA256 signature over the input, then compares the incoming signature with that correct signature.
The comparison step is coded as:

for(auto i=0u; i<crypto_generichash_BYTES; ++i) {
if(dataHash[i] != *(++sigVal)) {
//failureCB(data, "Signature Value does not match hash");
return false;
}
}
return true;

return std::memcmp(sigVal, dataHash.data(), dataHash.size()) == 0;

The std::memcmp function returns as soon as finding the first different element.
As a result, these functions are vulnerable to timing attacks because the execution time of these function leaks the information about which is the first byte that differs from the correct signature.

To fix this bug, use a constant-time comparison function such as sodium_memcmp.

MBPS Publication Failed to Publish to the collection

Following Environment setup in #3,
When running the operator from a setup similar to MBPS app2, we have the following log:

operator:alice-38782 msg #7 published to Collection.
operator:alice-38782 msg #8 published to Collection.
operator:alice-38782 msg #9 published to Collection.
Application entity operator:alice-38782 received message:
	capability = lock
	topic = event
	location = frontdoor
	arguments = locked
	message creation time = 1626927042172072 (3.16138mS)
	message body: Message number 4 from device:frontdoor-38780
operator:alice-38782 msg #10 timed out without reaching Collection.
operator:alice-38782 msg #11 published to Collection.
Application entity operator:alice-38782 received message:
	capability = lock
	topic = event
	location = frontdoor
	arguments = battery_low
	message creation time = 1626927044187709 (3.41476mS)
	message body: Message number 6 from device:frontdoor-38780

Where the message 10 has failed to reach collection. However, the other peer seems to have received the message.

Would you mind looking into this error message?

Thanks.

SigMgr::stNULL does not match NDN specifications

In SignatureType assigned numbers, Null signature was assigned the number 200 (decimal) on 2020-06-19.
DCT should use the officially assigned SignatureType number for Null signature.

// Signature types (must match equivalent NDN TLV when there is one)
static constexpr SigType stSHA256 = 0;
static constexpr SigType stAEAD = 7;
static constexpr SigType stEdDSA = 8;
static constexpr SigType stRFC7693 = 9;
static constexpr SigType stNULL = 10;

Prefix registration error in mbps sample applications

Starting the sample applications, e.g., app2 frequently causes prefix registration errors. To reproduce the identical environment, spin-up a VM using the following Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
  config.vm.define "dct-dev-1" 
  config.vm.box = "bento/ubuntu-20.04"
  config.vm.hostname = "dct"
  config.vm.provider "virtualbox" do |vb|
    vb.name = "dct-dev-1"
    vb.cpus = "4"
    vb.memory = "8000"
  end
  config.vm.provision "shell", privileged: false, inline: <<-SHELL
    sudo apt-get update
    sudo apt-get -y install gcc-10 g++-10 build-essential \
                            pkg-config python3-minimal libboost-all-dev \
                            libssl-dev libsqlite3-dev libpcap-dev \
                            libsodium-dev libz-dev \
                            liblog4cxx-dev
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
    sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 100
    git clone https://github.com/pollere/NDNpatches
    git clone https://github.com/named-data/ndn-cxx
    cd ndn-cxx
    git apply ../NDNpatches/patch.key-impl
    ./waf configure
    ./waf
    sudo ./waf install
    sudo ldconfig
    cd ..
    git clone https://github.com/named-data/NFD
    cd NFD
    git submodule update --init
    ./waf configure
    ./waf
    sudo ./waf install
    sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
    cd ..
    git clone https://github.com/operantnetworks/ndn-ind
    cd ndn-ind
    git apply ../NDNpatches/patch.ndn-ind
    ./configure
    make -j
    sudo make install
    sudo ldconfig
    cd ..
    git clone https://github.com/pollere/DCT
    cd DCT/
    cd tools/
    make -j
    cd ../examples/mbps
    make -j
    wget https://github.com/pollere/DCT/releases/download/v3.0/linux-schemaCompile-bin-1.2.0.tgz
    tar -xzvf linux-schemaCompile-bin-1.2.0.tgz
    rm linux-schemaCompile-bin-1.2.0.tgz
    ./schemaCompile -o mbps1.scm mbps1.trust
    ../../tools/make_cert -s EdDSA -o mbps1.root myNet/mbps1
    ../../tools/schema_cert -o mbps1.schema mbps1.scm mbps1.root
    ../../tools/make_cert -s EdDSA -o alice.cert myNet/mbps1/operator/alice mbps1.root
    ../../tools/make_cert -s EdDSA -o bob.cert myNet/mbps1/operator/bob mbps1.root
    ../../tools/make_cert -s EdDSA -o cathy.cert myNet/mbps1/operator/cathy mbps1.root
    ../../tools/make_bundle -o alice.bundle mbps1.root mbps1.schema +alice.cert
    ../../tools/make_bundle -o bob.bundle mbps1.root mbps1.schema +bob.cert
    ../../tools/make_bundle -o cathy.bundle mbps1.root mbps1.schema +cathy.cert
    cd ../../..
    ndnsec key-gen /ndn/alice
  SHELL
end

The Vagrantfile already creates three identities for the operators "Alice", "Bob", and "Cathy" in the folder DCT/examples/mbps/.

After starting NFD, repeatedly starting app2 causes the following error:

./app2 alice.bundle 
22:50.000232 ERROR /localnet/mbps1/cert  onRegisterFailed /localnet/mbps1/cert
22:50.000232 ERROR ndn.Node      Node::RegisterResponse::operator(): Error in onRegisterFailed: onRegisterFailed /localnet/mbps1/cert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.