What is Acra
Acra — database security suite for sensitive and personal data protection.
Acra provides field level encryption (client-side or proxy-side), multi-layered access control, database leakage prevention, and intrusion detection capabilities in a convenient, developer-friendly package. Acra was specifically designed for web and mobile apps with centralised data storage, including with distributed, microservice-rich applications.
|Perfect Acra-compatible applications||Typical industries|
|Web and mobile apps that store data in a centralised database or object storage||
|IoT apps that collect telemetry and process data in the cloud|
|High-load data processing apps|
Acra gives you tools for encrypting the data records into special cryptographic containers, storing them in the database or file storage and then decrypting them in a secure compartmented area (separate virtual machine/container). Acra allows to encrypt data as early as possible and operate on encrypted data.
Acra’s cryptographic design ensures that no secret (password, key, etc.) leaked from the application or database will be sufficient for decryption of the protected data chunks that originate from it. Acra minimises the leakage scope, detects unauthorised behavior, and prevents the leakage, informing operators of the incident underway.
This is Acra Community Edition, it’s free for commercial and non-commercial use, forever.
Major security features
|| field level encryption (client-side and/or proxy-side);
each data record is encrypted using unique encryption keys
||select which field/columns to encrypt to balance good security and performance|
||built-in tools for key distribution, key rotation (with/without data re-encryption), and compartmentalisation|
||datastore and application components can be compromised, yet the data stays protected|
||through a built-in SQL firewall|
||using poison records (honey tokens) to warn about suspicious behaviour|
||encryption/decryption using AcraTranslator|
||available for Acra Enterprise users|
Acra delivers different layers of defense for different parts and stages of the data lifecycle. This is what defence in depth is – an independent set of security controls aimed at mitigating multiple risks in case of an attacker crossing the outer perimeter.
Developer and DevOps friendly
||your infrastructure is secure from the start without additional configuring|
under the hood
|no risk of selecting the wrong key length or algorithm padding|
||easy to configure and automate|
||via binary packages or Docker images|
||client-side encryption libraries support ~11 languages|
||available for server-side encryption in AcraServer’s Transparent proxy mode|
|| throughout all Acra components;
compatible with ELK stack, Prometheus, Jaeger
||rollback utilities to decrypt database into plaintext|
||numerous web-based and Docker-based example projects available|
||run AcraServer in your DigitalOcean cloud|
||we can setup and manage Acra for you|
Acra relies on our cryptographic library Themis, which implements high-level cryptosystems based on the best available open-source implementations of the most reliable ciphers. Acra strictly doesn’t contain self-made cryptographic primitives or obscure ciphers. To deliver its unique guarantees, Acra relies on the combination of well-known ciphers and smart key management scheme.
|Default crypto-primitive source||OpenSSL|
|Supported crypto-primitive sources ᵉ||BoringSSL, LibreSSL, FIPS-compliant, GOST-compliant, HSM|
|Storage encryption||AES-256-GCM + ECDH|
|Transport encryption||TLS v1.2+ / Themis Secure Session|
|KMS integration ᵉ||Amazon KMS, Google Cloud Platform KMS, Hashicorp Vault, Keywhiz|
Try Acra without writing code
How does Acra work?
To better understand the architecture and data flow in Acra, please refer to the Architecture and data flow section in the documentation.
Protecting data in SQL databases using AcraServer
AcraServer works as transparent encryption/decryption proxy with SQL databases. Depending on your app architecture, it’s possible to use client-side encryption or server-side encryption, or both simultaneously.
Integrating client-side encryption using AcraWriter
The typical infrastructure with AcraConnector and AcraServer, data is encrypted on the client side (web backend or mobile app) using AcraWriter, decrypted on the AcraServer side, that works as transparent database proxy.
The dataflow of encrypted and plaintext data. Note: it’s possible to write encrypted data directly to the database, omitting the AcraServer.
This is what the process of encryption and decryption of data in a database looks like:
- Your application encrypts some data through AcraWriter by generating an AcraStruct using Acra storage public key and then updates the database. AcraStructs generated by AcraWriter can’t be decrypted by it — only the Acra’s server side has the keys for decryption.
- To retrieve the decrypted data, your application talks to AcraServer. It is a server-side service that works as a database proxy: it transparently sits between your application and the database and silently listens to all the traffic coming to and from the database.
- AcraServer monitors the incoming SQL requests and blocks the unwanted ones using the built-in configurable SQL firewall called AcraCensor. AcraServer only sends allowed requests to the database. Certain configurations for AcraServer can be adjusted remotely using AcraWebConfig web server.
- Upon receiving the database response, AcraServer tries to detect AcraStructs, decrypts them, and returns the decrypted data to the application.
- AcraConnector is a client-side daemon responsible for providing encrypted and authenticated connection between the application and AcraServer. AcraConnector runs under a separate user/in a separate container and acts as middleware. AcraConnector accepts connections from the application, adds an extra transport encryption layer using TLS or Themis Secure Session, sends the data to AcraServer, receives the result, and sends it back to the application.
Integrating proxy-side encryption using AcraServer in Transparent proxy mode
The typical infrastructure with AcraConnector and AcraServer, data is encrypted and decrypted by AcraServer, that works as transparent database proxy.
The dataflow of encrypted and plaintext data, AcraServer it encrypts and decrypts data.
Transparent proxy mode allows you to configure AcraServer to encrypt records in specific database columns without altering the application code. Basically, AcraServer here performs AcraWriter’s duties.
This mode is useful for large distributed applications, where separate updating of the source code for each client app is complicated.
- Imagine that the client application wants to update some data in the database. The application logic doesn’t need to change because there’s no need to integrate AcraWriter library into the application code. The application sends SQL requests with plaintext data through AcraConnector and AcraServer to the database, as described above. There’s a secure transport layer between AcraConnector and AcraServer (via TLS or Themis Secure Session), so data from client app is transmitted via a secure channel.
- On receiving SQL queries, AcraServer parses each query and encrypts the desired values into AcraStructs. To know which values to encrypt, AcraServer uses a special configuration file (known as
encryptor_config_file) that describes which columns in which tables should be encrypted. AcraServer uses AcraStruct encryption key just as AcraWriter would.
- After encrypting the values into AcraStructs, AcraServer passes the modified queries to the database and the database response – back to the client application via AcraConnector.
- When the client application wants to read the data, it sends a read query to the database (via AcraConnector and AcraServer). Upon retrieving the database response, AcraServer tries to detect AcraStructs, decrypts them, and returns the decrypted data to the application.
Transparent mode has the same features as the “usual” mode – including SQL firewall, intrusion detection based on poison records, Zone support, etc.
Check out the detailed documentation on using and configuring the Transparent proxy mode.
Protecting data in any file storage using AcraWriter and AcraTranslator
The typical infrastructure with AcraConnector and AcraTranslator, data is encrypted on the client side (web backend or mobile app) using AcraWriter, decrypted on the AcraTranslator side, that works as standalone decryption service.
The dataflow of encrypted and plaintext data, AcraTranslator only decrypts data on demand.
In some use cases, the application can store encrypted data as separate blobs (in NoSQL databases, or as files that are not in a database, i.e. in a S3 bucket, local file storage, etc.). In this case, you can use AcraTranslator — a lightweight server that receives AcraStructs and returns the decrypted data.
Note: since Q3 2020, AcraTranslator can both encrypt and decrypt data via REST API (HTTP, gRPC). You may use a combination of AcraWriter+AcraTranslator for client-side encryption and Translator-side decryption; or AcraTranslator only for both encryption and decryption without changing app code.
This is what the process of encryption and decryption of data using AcraTranslator looks like:
- Your application encrypts some data using AcraWriter, generating an AcraStruct using Acra storage public key and puts the data into any file storage. AcraStructs generated by AcraWriter can’t be decrypted by it — only the Acra’s server side has the right keys for decrypting it. Otherwise, you might decide not to use AcraWriter, but use AcraTranslator for encrypting data – application sends plaintext, AcraTranslator returns AcraStructs.
- To decrypt an AcraStruct, your application sends it to AcraTranslator as a binary blob via HTTP or gRPC API. AcraTranslator doesn’t care about the source of the data, it is responsible for holding all the secrets required for data decryption and for actually decrypting the data.
- AcraTranslator decrypts AcraStructs and returns the decrypted data to the application.
- To avoid sending plaintext via an unsecured channel, AcraTranslator requires the use of AcraConnector, a client-side daemon responsible for providing encrypted and authenticated connection between the application and AcraServer. AcraConnector runs under a separate user/in a separate container and acts as middleware. It accepts connections from the application, adds transport encryption layer using TLS or Themis Secure Session, sends data to AcraServer, receives the result, and sends it back to the application.
AcraTranslator and AcraServer are fully independent server-side components and can be used together or separately depending on your infrastructure.
AcraWriter is a client-side library that encrypts data into a special binary format called AcraStruct. AcraWriter is available for Ruby, Python, Go, C++, Node.js, iOS, Android/Java and PHP, but you can easily generate AcraStruct containers with Themis for any platform you want.
AcraWriter is required only for the client-side encryption dataflow. If you use AcraServer in Transparent encryption mode, or use AcraTranslator for both encryption and decryption, you don’t need AcraWriter at all.
|Client platform||Documentation and guides||Examples||Package manager|
The Server-side Acra components (AcraServer, AcraTranslator) should run as separate services/servers/VMs. Key management utils and database helpers are usually run on the same server as AcraServer/AcraTranslator.
- There are several possible ways to install and launch Acra components in your infrastructures:
- download and run our Docker-based demo stand to deploy everything you need using a single command.
- download pre-built Acra binaries for supported distributives.
- install AcraServer droplet on DigitalOcean, configure manually or use pre-defined interactive configuration script.
- build from sources (Acra is built and tested with Go versions 1.13 – 1.15).
- talk to us, if you would like to run managed Acra (Acra-as-a-Service).
Install Server-side Acra components:
|Distributive||Instruction set||Download package||or alternatively|
|CentOS 7||x86_64||rpm package||use Docker or
build from source
|Debian Stretch (9)
Debian Jessie (8)
|Ubuntu Bionic (18.04)||x86_64||deb package|
|Ubuntu Artful (17.10)
Ubuntu Xenial (16.04)
|macOS (10.12 – 10.14)||x86_64||–|
Note: the server-side Acra components are not compatible with Windows OS as host OS, consider using Docker.
Compatibility and integration
AcraServer is a server-side service that works as database proxy: it sits transparently between your application and the database, listens silently to all the traffic that’s coming to and from the database. AcraTranslator is database-agnostic: it provides HTTP and gRPC API to decrypt AcraStructs stored anywhere.
Acra is compatible with numerous RDBMS, object and KV stores, cloud platforms, external key management systems (KMS), load balancing systems.
|Cloud platforms||DigitalOcean, AWS, GCP, Heroku|
|RDBMS|| MySQL v5.7+, PosgtreSQL v9.4-v11, MariaDB v10.3
Google Cloud SQL, Amazon RDS
|Object stores||filesystems, KV databases, Amazon S3, Google Cloud DataStore|
|Load balancing||HAProxy, cloud balancers|
Open source Acra has limited integration support, more services are available in the Enterprise version of Acra only.
Installation and launch
Quick try (run example apps)
Acra Example Projects illustrate the integration of Acra data protection suite into existing applications: web applications based on Django and Ruby on Rails frameworks, and simple CLI applications. We took well-known apps, detected sensitive data there and added the encryption layer. Protecting the data is completely transparent for the users and requires minimal changes in the infrastructure and application code.
Developers and Ops friendly:
- run a single command to deploy the application, database, Acra’s components, logs, and dashboards;
- read the code changes and see how little it takes to integrate encryption into the client application;
- learn how Acra works by reading logs, monitoring metrics in Prometheus, checking tracers in Jaeger and watching Grafana dashboards;
- inspect Docker-compose files, architecture schemes, database tables, and much more.
Requirements: Linux or macOS with installed Docker.
Quick integration into your infrastructure
For a quick and easy integration of Acra into your own infrastructure, we recommend trying Acra with Docker first. Using only two commands, you will get all the Acra’s components and database up and running, with a secure transport layer between them. We prepared several typical infrastructure variants to experiment with.
- Select one appropriate use case from the pre-made configurations (“Compose files”): use AcraServer-based configuration to protect the data in a database or select AcraTranslator to protect the files or any other binary blob stored elsewhere.
- Launch Acra’s server-side by running the selected Docker-compose file: it will generate the appropriate keys, put them into correct folders, perform a public key exchange, run selected services and database, and then it will listen to the incoming connections.
- Integrate AcraWriter into your application code where you need to protect the sensitive data, supply AcraWriter with an Acra storage public key (generated by Docker-compose on the previous step). Encrypt the data into AcraStructs and send them into the database or file storage.
- Decrypt data by reading the database through AcraServer or by decrypting the files through AcraTranslator.
Please use the Acra Docker demo stand for testing/experimenting purposes only as the encryption keys are pre-generated in the configuration.
Normal integration into your infrastructure
For production environments, we insist on generating and exchanging keys manually and deploying Acra as Docker containers or from source code. Refer to the Quick Start guide to understand how to download and launch Acra components, generate keys, and perform the key exchange properly.
Documentation, tutorials, additional information
The most recent versions of the documentation, tutorials, and demos for Acra are available on the official Cossack Labs Documentation Server. The Github Wiki documentation is deprecated and is no longer updated since v0.82.0.
To gain an initial understanding of Acra, you might want to:
- Read about using the lightweight HTTP web server AcraWebConfig we provide to manage AcraServer configuration in a simple fashion.
- Read the notes on security design and intrusion detection to better understand what you get when you use Acra and what is the threat model that Acra operates in.
- Key and trust management tools: key distribution, key rotation and database rollback.
- Set up rules for AcraCensor (SQL firewall) suitable for your application.
- Read some notes on making Acra stronger, more productive, and efficient and about adding security features or increasing throughput, depending on your goals and security model.
- Read about the logging format that Acra supports if you are using a SIEM system.
You can also check out the speaker slides for the following talks by Cossack Labs engineers:
- “Encryption Without Magic, Risk Management Without Pain” by Anastasiia Voitova.
- “Data encryption for Ruby web applications” by Dmytro Shapovalov.
- “Building SQL firewall(AcraCensor): insights from developers” by Artem Storozhuk.
|Client-side encryption mode||Transparent encryption mode|
AcraCensor: SQL firewall to prevent SQL injections
The demo project has a Docker-compose file that runs the following web infrastructure:
- OWASP Mutillidae web application,
- Acra encryption suite.
Acra works as a proxy between web and database. AcraCensor inspects every SQL query that runs from the web application to the database, and back, and blocks suspicious queries.
Requirements: Linux or macOS with installed Docker.
Poison records: intrusion detection example
Intrusion detection example application illustrates how to use poison records (honey tokens) as “intrusion markers” that warn about possible attack.
Requirements: Linux or macOS with installed Docker.
Acra Load Balancing Example
Acra load balancing example application illustrates building high availability and balanced infrastructure, based on Acra components, PostgreSQL, and Python web application. We prepared several configurations with multiple databases and HAProxy.
GDPR, HIPAA, CCPA
Acra can help you comply with the current privacy regulations, such as:
- General Data Protection Regulation (GDPR)
- HIPAA (Health Insurance Portability and Accountability Act)
- DPA (Data Protection Act)
- CCPA (California Consumer Privacy Act)
Configuring and using Acra in a designated form will cover most of the demands described in articles 25, 32, 33, and 34 of GDPR and the PII data protection demands of HIPAA. Read more about Acra and GDPR compliance here.
Open source vs Pro vs Enterprise
This is Acra Community Edition, the open source version of Acra, which is
free for commercial and non-commercial usage. Please let us know in the Issues if you stumble upon a bug, see a possible enhancement, or have a comment on security design.
There are also Pro and Enterprise versions of Acra available. Those versions provide better performance, redundancy/load balancing, come pre-configured with crypto-primitives of your choice (FIPS, GOST), have integration with key/secret management tools in your stack, provide unique security features like search through encrypted data, and have plenty of utils and tools for your Ops and SREs to operate Acra conveniently – deployment automation, scaling, monitoring, and logging. Talk to us to get full feature lists and a quote.
It takes more than just getting cryptographic code to compile to secure the sensitive data. Acra won’t make you “compliant out of the box” with all the modern security regulations, and no other tool will.
We help companies plan their data security strategy by auditing, assessing data flow, and classifying the data, enumerating the risks. We do the hardest, least-attended part of reaching the compliance – turning it from the “cost of doing business” into the “security framework that prevents risks”.
Contributing to us
If you’d like to contribute your code or provide any other kind of input to Acra, you’re very welcome. Your starting point for contributing is here.
Acra is licensed as Apache 2 open-source software.
To talk to the business wing of Cossack Labs Limited, drop us an email to [email protected].