Code Monkey home page Code Monkey logo

triplekill / acra Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cossacklabs/acra

0.0 0.0 0.0 9.4 MB

Database security suite for data-driven apps: database proxy with strong selective encryption, search through encrypted data, SQL injections prevention, intrusion detection, honeypots. Supports client-side and proxy-side encryption. Works for SQL databases and (limited functionality) for NoSQL databases.

Home Page: https://www.cossacklabs.com/acra/

License: Apache License 2.0

Go 79.49% Python 11.76% Ruby 0.40% Shell 1.00% JavaScript 0.26% PHP 0.12% Makefile 0.44% HTML 0.27% Dockerfile 0.84% Objective-C 0.65% Java 0.38% C++ 0.31% Yacc 4.07%

acra's Introduction

Acra: database security suite
Database protection suite with selective encryption and intrusion detection.


GitHub release Circle CI Coverage Status godoc
Server platforms Client platforms Install on DigitalOcean


Acra Live Demo Acra Engineering Demo Documentation Installation Examples and tutorials

What is Acra

Acra — database security suite for sensitive and personal data protection.

Acra provides selective encryption, 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
  • Healthcare
  • Finance
  • E-commerce
  • Critical infrastructures
  • Apps with > 1000 users
IoT apps that collect telemetry and process data in the cloud
High-load data processing apps

Acra gives you tools for encrypting the data on the application's side 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'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.

User Acra suite for protecting data

Major security features

  • Cryptographic protection of data
  • during storage and transmission, using unique encryption keys per data blob, per user, per application
  • Selective encryption
  • protect only the sensitive data to balance good security and performance
  • Key management tools
  • built-in tools for key distribution, key rotation, and compartmentalisation
  • Trust compartmentalisation
  • datastore and application components can be compromised, yet the data stays protected
  • Prevention of SQL injections
  • through a built-in SQL firewall
  • Intrusion detection system
  • early warning about suspicious behaviour
  • Searchable encryption ᵉ
  • available for Acra Enterprise users
  • Pseudonymisation
  • coming in the (nearest) future releases
  • Cryptographically protected audit log
  • 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

  • Secure default settings
  • your infrastructure is secure from the start without additional configuring
  • Cryptography is hidden
    under the hood
  • no risk of selecting the wrong key length or algorithm padding
  • Automation-friendly
  • easy to configure and automate
  • Quick infrastructure integration
  • via binary packages or Docker images
  • Easy client-side integration
  • client-side encryption libraries support ~11 languages
  • Code-less client-side integration
  • available for server-side encryption in AcraServer's Transparent proxy mode
  • Logging, metrics, tracing
  • throughout all Acra components;
    compatible with ELK stack, Prometheus, Jaeger
  • No vendor lock
  • rollback utilities to decrypt database into plaintext
  • Demos, examples, simulators
  • numerous web-based and Docker-based example projects available
  • DigitalOcean Acra 1-Click App
  • run AcraServer in your DigitalOcean cloud
  • Managed solution available
  • we can setup and manage Acra for you

    Cryptography

    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

    ᵉ — available in the Enterprise version of Acra only. Drop us an email to get a full list of features and a quote.

    Try Acra without writing code

    Acra Live Demo (see Acra in action in one click)

    Acra Live Demo is a web-based demo of protecting data in a typical web-infrastructure (deployed on our servers for your convenience).

    Acra Live Demo infrastructure contains: Django-based application, PostgreSQL database, AcraServer with AcraCensor, log monitor. Sensitive data is encrypted in a Django application, stored in a database, and decrypted through Acra.

    From the users' perspective, the website's work is unchanged. However, the data is securely protected so that even hacking the web application won't lead to data leakage.

    The available actions include:

    Requirements: Chrome, Firefox, or Safari browser.

    Note: We create separate playground for each user, that's why we ask for your email; you'll receive the invitation link.

    🖥 Request Acra Live Demo 🖥

    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

    Client-side encryption using AcraServer and 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.

    Client-side encryption using AcraServer and AcraWriter

    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 server-side encryption using AcraServer in Transparent proxy mode

    Server-side encryption using AcraServer

    The typical infrastructure with AcraConnector and AcraServer, data is encrypted and decrypted by AcraServer, that works as transparent database proxy.

    Server-side encryption using AcraServer

    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

    Client-side encryption and standalone decryption using 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.

    Acra Translator: simplified architecture

    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.

    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.
    • 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.

    Availability

    Client-side

    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, you don't need AcraWriter at all.

    Client platform Documentation and guides Examples Package manager
    🐹 Go Installation guide examples/golang
    🐍 Python Installation guide examples/python PyPI
    ♦️ Ruby Installation guide examples/ruby Gem
    ➕ C++ Installation guide examples/cpp
    📱 iOS (Swift / Objective-C) Installation guide examples/objc CocoaPods
    ☎️ Android (Java / Kotlin) Installation guide examples/android_java maven
    🐘 PHP Installation guide examples/php
    🍭 Node.js Installation guide examples/nodejs npm

    Server-side

    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.

    Install Server-side Acra components:

    Distributive Instruction setDownload packageor alternatively
    CentOS 7x86_64rpm package use Docker or
    build from source
    Debian Stretch (9)
    Debian Jessie (8)
    x86_64/i386deb package
    Ubuntu Bionic (18.04)x86_64deb package
    Ubuntu Artful (17.10)
    Ubuntu Xenial (16.04)
    x86_64/i386deb package
    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.

    ⚙️ Run Acra Example Projects ⚙️

    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:

    You can also check out the speaker slides for the following talks by Cossack Labs engineers:

    Demo projects

    Django sample project RubyGems sample project

    AcraCensor Example (SQL firewall in action)

    AcraCensor Demo is an example project that illustrates how to use AcraCensor as SQL firewall to prevent SQL injections. The target application is a well-known vulnerable web application OWASP Mutillidae 2.

    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.

    Watch the video

    Requirements: Linux or macOS with installed Docker.

    ⚙️ Run AcraCensor SQL firewall example ⚙️

    Acra Load Balancing Example (HAProxy-based infrastructures)

    Acra Load Balancing Example 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.

    🔛 Run Acra Load Balancing Example 🔛

    GDPR and HIPAA

    Acra can help you comply with GDPR and HIPAA regulations. 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, redunancy/load balancing, come pre-configured with crypto-primitives of your choice (FIPS, GOST), integrate 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.

    Security consulting

    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.

    License

    Acra is licensed as Apache 2 open-source software.

    Contacts

    If you want to ask a technical question, feel free to raise an Issue or write to [email protected].

    To talk to the business wing of Cossack Labs Limited, drop us an email to [email protected].

    Blog Twitter CossackLabs Medium CossackLabs

    acra's People

    Contributors

    alexshmelev avatar gene-eu avatar karenswry avatar lagovas avatar mnaza avatar mozhmike avatar shadinua avatar storojs72 avatar vixentael avatar

    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.