Git Product home page Git Product logo

certificate-transparency's Introduction

certificate-transparency: Auditing for TLS certificates

This repository is no longer actively maintained.

The CT log server and client written in Go are available at google/trillian and google/certificate-transparency-go.


Introduction

This repository holds open-source code for functionality related to certificate transparency (CT). The main areas covered are:

  • A collection of client tools and libraries for interacting with a CT Log, in various programming languages.

The supported platforms are:

  • Linux: tested on Ubuntu 14.04; other variants (Fedora 22, CentOS 7) may require tweaking of compiler options.
  • OS X: version 10.10
  • FreeBSD: version 10.*

C++ Log Server Deprecation Notice

The CT log server implementation which used to be in this repository is no longer under active development. We recommend that new deployments use the new Go based server, which can handle much larger Merkle trees:

CT Personality Generic Backend

For more information on why we recommend this see the Deprecation Notes

N.B. This notice refers to the servers only, not the other client code in this repository.

Build Quick Start

First, ensure that the build machine has all of the required build dependencies. Then use gclient to retrieve and build the other software needed by the Log, and then use (GNU) make to build and test the CT code:

export CXX=clang++ CC=clang
mkdir ct  # or whatever directory you prefer
cd ct
gclient config --name="certificate-transparency" https://github.com/google/certificate-transparency.git
gclient sync --disable-syntax-validation  # retrieve and build dependencies
# substitute gmake or gnumake below if that's what your platform calls it:
make -C certificate-transparency check  # build the CT software & self-test

Code Layout

The source code is generally arranged according to implementation language, in the cpp and python subdirectories. (Java and Go code are in separate repositories.)

The key subdirectories are:

  • For the main distributed CT Log itself:
    • cpp/log: Main distributed CT Log implementation.
    • cpp/merkletree: Merkle tree implementation.
    • cpp/monitoring: Code to export operation statistics from CT Log.
  • Client code for accessing a CT Log instance:
    • cpp/client: CT Log client code in C++
    • python/ct: CT Log client code in Python

Building the Code

The CT software in this repository relies on a number of other open-source projects, and we recommend that:

  • The CT software should be built using local copies of these dependencies rather than installed packages, to prevent version incompatibilities.
  • The dependent libraries should be statically linked into the CT binaries, rather than relying on dynamically linked libraries that may be different in the deployed environment.

The supported build system uses the gclient tool from the Chromium project to handle these requirements and to ensure a reliable, reproducible build. Older build instructions for using Ubuntu or Fedora packages and for manually building dependencies from source are no longer supported.

Within a main top-level directory, gclient handles the process of:

  • generating subdirectories for each dependency
  • generating a subdirectory for for the CT Log code itself
  • building all of the dependencies
  • installing the built dependencies into an install/ subdirectory
  • configuring the CT build to reference the built dependencies.

Under the covers, this gclient build process is controlled by:

  • The master DEPS file, which configures the locations and versions of the source code needed for the dependencies, and which hooks onto ...
  • The makefiles in the build/ subdirectory, which govern the build process for each dependency, ensuring that:
    • Static libraries are built.
    • Built code is installed into the local install/ directory, where it is available for the build of the CT code itself.

Build Dependencies

The following tools are needed to build the CT software and its dependencies.

  • depot_tools
  • autoconf/automake etc.
  • libtool
  • shtool
  • clang++ (>=3.4)
  • cmake (>=v3.1.2)
  • git
  • GNU make
  • Tcl
  • pkg-config
  • Python 2.7

The exact packages required to install these tools depends on the platform. For a Debian-based system, the relevant packages are: autoconf automake libtool shtool cmake clang git make tcl pkg-config python2.7

Software Dependencies

The following collections of additional software are used by the main CT Log codebase.

  • Google utility libraries:
    • gflags: command-line flag handling
    • glog: logging infrastructure, which also requires libunwind.
    • Google Mock: C++ test framework
    • Google Test: C++ mocking framework
    • Protocol Buffers: language-neutral data serialization library
    • tcmalloc: efficient malloc replacement optimized for multi-threaded use
  • Other utility libraries:
    • libevent: event-processing library
    • libevhtp: HTTP server plug-in/replacement for libevent
    • json-c: JSON processing library
    • libunwind: library for generating stack traces
    • OpenSSL: default cryptography library.

Build Troubleshooting

Compiler Warnings/Errors

The CT C++ codebase is built with the Clang -Werror flag so that the codebase stays warning-free. However, this can cause build errors when newer/different versions of the C++ compiler are used, as any newly created warnings are treated as errors. To fix this, add the appropriate -Wno-error=<warning-name> option to CXXFLAGS.

For example, on errors involving unused variables try using:

CXXFLAGS="-O2 -Wno-error=unused-variable" gclient sync

If an error about an unused typedef in a glog header file occurs, try this:

CXXFLAGS="-O2 -Wno-error=unused-variable -Wno-error=unused-local-typedefs" gclient sync

When changing CXXFLAGS it's safer to remove the existing build directories in case not all dependencies are properly accounted for and rebuilt. If problems persist, check that the Makefile in certificate-transparency contains the options that were passed in CXXFLAGS.

Working on a Branch

If you're trying to clone from a branch on the CT repository then you'll need to substitute the following command for the gclient config command above, replacing branch as appropriate

gclient config --name="certificate-transparency" https://github.com/google/certificate-transparency.git@branch

Then continue the build process with the gclient sync step.

Testing the Code

Unit Tests

The unit tests for the CT code can be run with the make check target of certificate-transparency/Makefile.

Testing and Logging Options

Note that several tests write files on disk. The default directory for storing temporary testdata is /tmp. You can change this by setting TMPDIR=<tmpdir> for make.

End-to-end tests also create temporary certificate and server files in test/tmp. All these files are cleaned up after a successful test run.

For logging options, see the glog documentation.

By default, unit tests log to stderr, and log only messages with a FATAL level (i.e., those that result in abnormal program termination). You can override the defaults with command-line flags.

certificate-transparency's People

Contributors

aeijdenberg avatar alcutter avatar benlaurie avatar client9 avatar davidben avatar daviddrysdale avatar dsnet avatar ekasper avatar emaste avatar eranmes avatar fhossain avatar gdbelvin avatar jsha avatar knikolov82 avatar kovrus avatar laiqu avatar martin2112 avatar mehmooda avatar phad avatar philandstuff avatar pleroy avatar pphaneuf avatar rep avatar rjpercival avatar rolandshoemaker avatar rutsky avatar taknira avatar thechauffeur avatar trawick avatar ytrezq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

certificate-transparency's Issues

CT make test error with binary openssl

With a "Build successful" compilation of CT, I try to test the installation, going to /test, and executing: make OPENSSLDIR=”/usr/local/ssl” GTESTDIR=”/home/izenpe/CT/gtest-1.6.0” test
I am using a default binary installation of openssl, so I don't have the /usr/local/ssl/apps/openssl directory. The error it shows is:

BUILD SUCCESSFUL
Total time: 2 seconds
make[2]: Entering directory /home/izenpe/CT/certificate-transparency/python' make[2]: Nothing to be done forall'.
make[2]: Leaving directory /home/izenpe/CT/certificate-transparency/python' make[1]: Leaving directory/home/izenpe/CT/certificate-transparency'
OPENSSLDIR=/usr/local/ssl ./sslconnect_test.sh
./sslconnect_test.sh: line 114: /usr/local/ssl/apps/openssl: No such file or directory
make: *** [test] Error 127

Is there any way to execute these tests with a binary installation of openssl?. I have downloaded the CT source code using git.
Thanks

should synthesize empty STHs

When the log is empty, get-sth returns this:

{
  "tree_size":0,
  "timestamp":0,
  "sha256_root_hash":"",
  "tree_head_signature":"AAAAAA=="
}

It should instead sign an empty tree (which can be done on the fly, not a big deal), and return that.

handler.cc compilation error

When I try to install CT, in the step where the script tries to compile handler.cc this is the error I get:

server/handler.cc: In member function 'void cert_trans::HttpHandler::GetEntries(evhttp_request_) const':
server/handler.cc:284:31: error: comparison between signed and unsigned integer expressions [-Werror=sig n-compare]
for (size_t i = start; i <= end; ++i) {
^
server/handler.cc: In member function 'void cert_trans::HttpHandler::GetProof(evhttp_request_) const':
server/handler.cc:354:65: error: comparison between signed and unsigned integer expressions [-Werror=sig n-compare]
if (tree_size < 0 || tree_size > manager_->GetSTH().tree_size()) {
^
cc1plus: all warnings being treated as errors
make[1]: *** [server/handler.o] Error 1
make[1]: Leaving directory `/home/izenpe/CT/certificate-transparency/cpp'
make: *** [cpp] Error 2


Source code is downloaded this morning, using "git clone https://github.com/google/certificate-transparency.git". Flags used to compile are: make GTESTDIR=”/home/izenpe/CT/gtest-1.6.0” CPPNETLIBDIR="/home/izenpe/CT/ cpp-netlib-0.10.1".
Also I used export LOCAL_CXXFLAGS="-Wno-error=unused-local-typedefs" to avoid errors like "all warnings being treated as errors", but they are still appearing
Thanks

'SSL_CTX_set_custom_cli_ext' was not declared in this scope

With CT source code just downloaded with git, "git clone https://github.com/google/certificate-transparency.git", I get the following compilation error:

g++ -I . -I /home/izenpe/CT/openssl-OpenSSL_1_0_2-stable/include -I /home/izenpe/CT/gtest-1.6.0/include -I /usr/local/include -Wall -Werror -g -O3 -I/usr/local/include/json-c -c -o client/ssl_client.o client/ssl_client.cc
client/ssl_client.cc: In constructor 'SSLClient::SSLClient(const string&, uint16_t, const string&, LogVerifier_)':
client/ssl_client.cc:86:22: error: 'SSL_CTX_set_custom_cli_ext' was not declared in this scope
&verify_args_);
^
make[1]: *_* [client/ssl_client.o] Error 1
make[1]: Leaving directory `/home/izenpe/CT/certificate-transparency/cpp'

make: *** [cpp] Error 2

When I launch the make, I'm using a compiled version of openssl (1.0.2):

make OPENSSLDIR="/home/izenpe/CT/openssl-OpenSSL_1_0_2-stable" GTESTDIR="/home/izenpe/CT/gtest-1.6.0" CPPNETLIBDIR="/home/izenpe/CT/cpp-netlib-0.10.1"

Thanks

CT server should support RSA

I'm having some issues trying to launch my ct-server with a certificate generated with RSA 2048. It looks like it only allows Elliptic Curves. According to bullet point 2.1.4 of RFC 6962 "A log MUST use either elliptic curve signatures using the NIST P-256 curve (...) or RSA signatures using a key of at least 2048 bits. I'm not sure if i'm doing something wrong, or the Google CT server really doesn't allow any other algorithm than ECCs. This is the output in my console:

F1008 14:24:38.362268 7057 signer.cc:27] Unsupported key type 6

And if we take a look to signer.cc:27, it verifies that signature algorithm is ECDSA

Thanks

get-proof might not converge in a clustered setup

Imagine a cluster of multiple nodes, where an elected leader does the signing of new tree heads, the rest of the cluster are followers, possibly trailing behind by some arbitrary number of entries, and you have a load balancer in front of this that sends incoming requests arbitrarily. You could then get in this situation:

  1. client gets an STH, and happens to get it from the leader (most up to date)
  2. client tries to get proofs, but it goes to a follower that doesn't have a bit enough tree size
  3. client tries to get the STH again, hoping to get whatever tree size that the follower would accept, but it goes to the leader again
  4. client tries to get proofs again, but the same thing happens again

This could go on possibly forever, in a degenerate case.

@benlaurie said that there should be a single call to get the current STH, and a proof (if a hash was provided), and a consistency proof (if a tree size was provided), so that you could get a consistent view for a single logical operation.

This requires adding an entirely new function to the API, but @benlaurie suggested that if, at least, the get-proof call would return its current STH in case of an error, it could at least converge on a good answer, by keeping the STH that had the smallest tree size, and using that for retrying the get-proof call. In that case, the previous scenario would play out like this:

  1. client gets an STH, and happens to get it from the leader (most up to date)
  2. client tries to get proofs, it goes to a follower that doesn't have a bit enough tree size, so it gets an error, accompanied with its (older) STH
  3. client tries to get proofs again, based on the older STH tree size, it goes to the leader, which can answer the query, and the client can verify it against the STH it received previously

This would still be an extension from what is specified in the RFC, but can be implemented within it (the RFC doesn't specify at all the body of the response in case of error).

IllegalFlagValue in /certificate-transparency/python/ct/client/tools/print_log_list.py

If launch the tool "python print_log_list.py" I get the following error:

Traceback (most recent call last):
File "print_log_list.py", line 155, in
sys.argv = FLAGS(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/gflags.py", line 1333, in call
self._AssertAllValidators()
File "/usr/local/lib/python2.7/dist-packages/gflags.py", line 1074, in _AssertAllValidators
self._AssertValidators(all_validators)
File "/usr/local/lib/python2.7/dist-packages/gflags.py", line 1093, in _AssertValidators
raise IllegalFlagValue('%s: %s' % (message, str(e)))
gflags.IllegalFlagValue: flag --log_list=None: Flag --log_list must be specified.

I think I fulfill all requirements, according to "pip install -r requirements.txt" output.
Thanks

doing get-entries for more than the current tree size

If a get-entries request is received for entries that we do not have, we should return what we do have.

This will be especially important in the context of a clustered implementation, where a request might be routed to a server that's a bit behind in the replication. The client should at least get what it can, and keep retrying to get what it's still missing, in that case.

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.