Skip to main content

PHT train container library

Project description

Documentation Status coverage

Train Container Library

Python library for pht-train images/containers.

Docker Images

The docker images defined by the Dockerfiles in the docker are the master images that need to be used when building train images.

Tests

Run the tests to validate the security protocol is working as intended. From this projects root directory run pytest train_lib

Available Images

  • master/python:slim: Alpine linux image with python 3.8 and the security protocol installed.
  • master/python:ubuntu: Ubuntu 20.04 image also with python 3.8 and the security protocol installed
  • master/python:dl: GPU enabled Ubuntu 18.04 image with tensorflow and pytorch and the SP preinstalled
  • master/python:ml: Ubuntu 20.04 image with additional ml libraries (sklearn, pandas, etc) installed
  • master/r:ml: Ubuntu 20.04 image with R and r machine learning packages installed

Security Protocol

The pht security protocol adapted from docs/Secure_PHT_latest__official.pdf performs two main tasks:

  1. Before executing a train-image on the local machine, unless the station is the first station on the route, the previous results need to be decrypted and the content of the image needs to be validated based on the configuration of the individual train -> pre-run.
  2. After executing the train the updated results need to be encrypted and the train configuration needs to be updated to reflect the current state ->post-run.

To function the protocol expects two environment variables to be set:

  1. STATION_ID String identifier that has public key/s registered with the central service
  2. RSA_STATON_PRIVATE_KEY Hex string containing the private key to be used for decryption and signing.

Pre-run protocol

The pre-run protocol consists of the following steps

  1. The hash of the immutable files (train definition) is verified making sure that the executable files did not change during the the train definition.
  2. The digital signature is verified ensuring the correctness of the results at each stop of the train.
  3. The symmetric key is decrypted using the provided station private key
  4. The mutable files in /opt/pht_results are decrypted using the symmetric key obtained in the previous step
  5. The decrypted files are hashed and the hash is compared to the one stored in the train configuration file.

Once these steps have been completed the image is ready to be executed.

Post-run protocol

  1. Calculate the hash of the newly generated results
  2. Sign the hash of the results using the provided RSA_STATION_PRIVATE_KEY
  3. Update the the train signature using the session id that is randomly generated at each execution step
  4. Encrypt the resulting files using a newly generated symmetric key
  5. Encrypt the generated symmetric key with the public keys of the train participants
  6. Update the train configuration file

With the completion of these steps the train is ready to be pushed into the registry for further processing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pht-train-container-library-0.9.0.tar.gz (37.8 kB view details)

Uploaded Source

Built Distributions

pht_train_container_library-0.9.0-py3.9.egg (109.5 kB view details)

Uploaded Source

File details

Details for the file pht-train-container-library-0.9.0.tar.gz.

File metadata

  • Download URL: pht-train-container-library-0.9.0.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.4

File hashes

Hashes for pht-train-container-library-0.9.0.tar.gz
Algorithm Hash digest
SHA256 4df6865c85a339f4a553bd68bd48eaf10a59e143ee3b45009e818769cebf2f9a
MD5 a0e14f04d17ff633dbd275aabd6a6678
BLAKE2b-256 0329d0391f8268bad95fa692ac3f97bcae7f3a240db7518fbe8152af1ab94703

See more details on using hashes here.

File details

Details for the file pht_train_container_library-0.9.0-py3.9.egg.

File metadata

  • Download URL: pht_train_container_library-0.9.0-py3.9.egg
  • Upload date:
  • Size: 109.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.4

File hashes

Hashes for pht_train_container_library-0.9.0-py3.9.egg
Algorithm Hash digest
SHA256 e7f328ccd60ea70ce0d11863c4d808ef807ac9919d53cff6fe1ae359d07b78a5
MD5 d58907145bd99e16cc8ed29f6a2c252a
BLAKE2b-256 bce5c66520184cf43219bcbf5bc2fe71f61a20f4ab062323c373bc9c69c031cd

See more details on using hashes here.

File details

Details for the file pht_train_container_library-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: pht_train_container_library-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.4

File hashes

Hashes for pht_train_container_library-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bba31a85fd49ad6c0fb58e0ad67505a67741fb2315e7b3c664dbf8faba39c740
MD5 96796b69d8e4ad9b1f8820c18af6add1
BLAKE2b-256 270248f14608e91d686989d2f9b1bd6a2a53ebc827dc7726d11993e0e05d1883

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page