cossacklabs / acra

Database security suite. Database proxy with field-level encryption, search through encrypted data, SQL injections prevention, intrusion detection, honeypots. Supports client-side and proxy-side ("transparent") encryption. SQL, NoSQL.
https://www.cossacklabs.com/acra/
Apache License 2.0
1.36k stars 128 forks source link

Test : regenerate SSL certificate for postgresql #506

Closed shadinua closed 2 years ago

shadinua commented 2 years ago

Previous certificate didn't contain postgresql name in SAN, just localhost:

openssl x509 -noout -text -in tests/ssl/postgresql/postgresql.crt

    Data:
        Version: 3 (0x2)
        Serial Number:
            3b:84:c1:a2:8a:44:d9:5f:99:ac:0b:d1:ef:19:af:36:6b:cb:b3:50
...
        Subject: C=GB, ST=London, L=London, O=Global Security, OU=IT, CN=Test leaf certificate
...
            X509v3 Subject Alternative Name:
                DNS:localhost

This made impossible to perform mTLS tests when Acra and PostgreSQL are located on different hosts.

That certificate may be integrated in some pre-built Docker images, so we intentionally do not revoke it. Here we just remove it from the repository and regenerated with both postgresql and localhost names in SAN. So all newer images will contain this certificate.

Also here we configured unique_subject = no in tests/ssl/ca/index.txt.attr to make it possible to not revoke previous certificate to regenerate it with the same name.

The new certificate:

    Data:
        Version: 3 (0x2)
        Serial Number:
            09:77:0d:64:b2:ad:5f:80:ac:30:21:f9:da:d5:13:e2:ad:89:74:07
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=GB, ST=London, L=London, O=Global Security, OU=IT, CN=Test CA certificate
        Validity
            Not Before: Feb 22 19:52:56 2022 GMT
            Not After : Feb 10 19:52:56 2072 GMT
        Subject: C=GB, ST=London, L=London, O=Global Security, OU=IT, CN=Test leaf certificate (postgresql)
...
            X509v3 Subject Alternative Name:
                DNS:localhost, DNS:postgresql