Skip to main content

A Python package that implements Attested TLS (aTLS).

Project description

Python aTLS Package

An implementation of Attested TLS (aTLS) for Python.

Supports the client-side handshake against a custom attester that issues JWT tokens via the Azure Attestation Service (AAS) running on Azure Container Instance (ACI) instances.

For the moment, this package exists to support OpaquePrompts, a confidential information redaction service that runs in a Trusted Execution Environment (TEE).

API Stability: This package is still in development. As such, its API may change until it is sufficiently mature.

Note: The server-side counterpart to this package is not yet public. If you are interested in using the aTLS functionality in this package, please reach out by filing an issue on GitHub.

Overview

Confidential computing is an emerging field focused on protecting data not only at rest and in transit, but also during use.

Typically, the security of a service running in the cloud depends on the security and trustworthiness of the cloud fabric it is hosted on and of the entity that provides the service. Additionally, there is no way for a user of such a service to ascertain, with cryptographic proof, that the service they are using really is the service they expect in terms of the very code that the service runs.

In contrast to traditional service deployments, with confidential computing one relies on Trusted Execution Environments, or TEEs. A TEE provides guarantees of confidentiality and integrity of code and data as well as a mechanism for remote entities to appraise its trustworthiness known as remote attestation, all rooted in hardware.

During remote attestation, the user of a service running inside a TEE challenges the service to produce evidence of its trustworthiness. This evidence includes measurements of the hosting environment, including hardware, firmware, and software stack that the service is running on, as well as measurements of the service itself. In turn, these measurements are produced in such a way that they are as trustworthy as the manufacturer of the TEE itself (e.g., Intel or AMD).

Perhaps most crucially, TEEs and remote attestation can be used to create services that run in such a way that neither the cloud fabric nor the service owner can neither access nor tamper with the service. That is, users of the service may convince themselves through remote attestation that any data that they share with the service will be shielded from the cloud fabric and also from the service provider.

This package aims to implement remote attestation for various TEEs in Python.

Design

The main workhorse of this package is the ATLSContext class. Instances of this class are parameterized with one or more Validators. A Validator can understand and appraise evidence or attestation results issued by an attester or verifier, respectively, contained in an attestation document created by an issuer, itself embedded in a TLS certificate.

The appraisal of an attestation document takes the place of the typical PKI-based certificate validation performed during regular TLS. By appraising an attestation document via Validators, the ATLSContext class binds the TLS handshake not to a PKI-backed entity but to a genuine TEE.

Sample Usage

The following snippet demonstrates how to use this package, assuming a service running on a confidential ACI instance with the corresponding attestation document issuer, and submit an HTTP request:

from atls import ATLSContext, HTTPAConnection
from atls.validators.azure.aas import AciValidator

validator = AciValidator()
ctx = ATLSContext([validator])
conn = HTTPAConnection("my.confidential.service.net", ctx)

conn.request("GET", "/index")

response = conn.getresponse()

print(f"Status: {response.status}")
print(f"Response: {response.data.decode()}")

conn.close()

Alternatively, this package integrates into the requests library by using the httpa:// scheme in lieu of https://, like so:

import requests

from atls.utils.requests import HTTPAAdapter
from atls.validators.azure.aas import AciValidator

validator = AciValidator()
session = requests.Session()
session.mount("httpa://", HTTPAAdapter([validator]))

response = session.request("GET", "httpa://my.confidential.service.net/index")

print(f"Status: {response.status_code}")
print(f"Response: {response.text}")

Note: The requests library is not marked as a dependency of this package because it is not required for its operation. As such, if you wish to use requests, install it via pip install requests prior to importing HTTPAAdapter.

Further Reading

If you are unfamiliar with the terms used in this README and would like to learn more, consider the following resources:

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

pyatls-0.0.6.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

pyatls-0.0.6-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file pyatls-0.0.6.tar.gz.

File metadata

  • Download URL: pyatls-0.0.6.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pyatls-0.0.6.tar.gz
Algorithm Hash digest
SHA256 173c5a569a012a7f4bade06ed07b68505d46d1e3a193c2e1d62d0ac47770b57b
MD5 7147c68a06509ea8d5d77181b71a30e6
BLAKE2b-256 f5bf47dda47a5eab330f21d7f80ef38c478ff06622c181dfe26ba2a8a4106c9f

See more details on using hashes here.

File details

Details for the file pyatls-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyatls-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pyatls-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0bfa2dd25ddc352cdb2122b37e847767bf24d0cfe9bb5b93208d2ee7b1569bfd
MD5 77bbed053b0694832afe6ef032ada60d
BLAKE2b-256 6b51dfd8efd9f60d1812310f7d218b88f2fcbbef3e2f1fa1b48ce7c84b9012e6

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