Install Google Certificate Transparency Python
Environment
- Debian 9.7 x64
- Python 2.7.13
pip
19.1.1
Excerpt
- https://www.certificate-transparency.org/libs
- https://github.com/google/certificate-transparency/tree/master/python
- https://github.com/google/protobuf/
Pre-requisite Install pip
Log 2019 / 05
1. Install Certificate Transparency
root@athos:~# pip list --format=freeze
chardet==2.3.0
euca2ools==3.3-devel
lxml==3.7.1
pip==19.1.1
PyYAML==3.12
requestbuilder==devel
requests==2.12.4
setuptools==33.1.1
six==1.10.0
urllib3==1.19.1
wheel==0.33.4
root@athos:~# apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade
apt-get -y --no-install-recommends install build-essential \
python-dev git unzip
root@athos:~# apt-get -y --no-install-recommends install build-essential \
> python-dev git unzip
root@athos:~# git clone https://github.com/google/certificate-transparency.git
Cloning into 'certificate-transparency'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 18604 (delta 4), reused 8 (delta 1), pack-reused 18576
Receiving objects: 100% (18604/18604), 27.27 MiB | 4.97 MiB/s, done.
Resolving deltas: 100% (12888/12888), done.
root@athos:~# pip install -r certificate-transparency/python/requirements.txt
(truncated)
Successfully built absl-py Twisted bitstring gviz-api.py functools32 pyrsistent
pycparser
ERROR: jsonschema 3.0.1 has requirement six>=1.11.0, but you'll have six 1.10.0
which is incompatible.
Installing collected packages: enum34, absl-py, dnspython, ecdsa, funcsigs, mock,
protobuf, attrs, Automat, PyHamcrest, constantly, idna, hyperlink, incremental,
zope.interface, asn1crypto, pycparser, cffi, ipaddress, cryptography, pyopenssl,
pyasn1, pyasn1-modules, service-identity, Twisted, bitstring, functools32,
pyrsistent, jsonschema, gviz-api.py
Successfully installed Automat-0.7.0 PyHamcrest-1.9.0 Twisted-19.2.0 absl-py-0.7.1
asn1crypto-0.24.0 attrs-19.1.0 bitstring-3.1.5 cffi-1.12.3 constantly-15.1.0
cryptography-2.6.1 dnspython-1.16.0 ecdsa-0.13.2 enum34-1.1.6 funcsigs-1.0.2
functools32-3.2.3.post2 gviz-api.py-1.8.2 hyperlink-19.0.0 idna-2.8
incremental-17.5.0 ipaddress-1.0.22 jsonschema-3.0.1 mock-3.0.5 protobuf-3.7.1
pyasn1-0.4.5 pyasn1-modules-0.2.5 pycparser-2.19 pyopenssl-19.0.0 pyrsistent-0.15.2
service-identity-18.1.0 zope.interface-4.6.0
root@athos:~# pip list --format=freeze
absl-py==0.7.1
asn1crypto==0.24.0
attrs==19.1.0
Automat==0.7.0
bitstring==3.1.5
cffi==1.12.3
chardet==2.3.0
constantly==15.1.0
cryptography==2.6.1
dnspython==1.16.0
ecdsa==0.13.2
enum34==1.1.6
euca2ools==3.3-devel
funcsigs==1.0.2
functools32==3.2.3.post2
gviz-api.py==1.8.2
hyperlink==19.0.0
idna==2.8
incremental==17.5.0
ipaddress==1.0.22
jsonschema==3.0.1
lxml==3.7.1
mock==3.0.5
pip==19.1.1
protobuf==3.7.1
pyasn1==0.4.5
pyasn1-modules==0.2.5
pycparser==2.19
PyHamcrest==1.9.0
pyOpenSSL==19.0.0
pyrsistent==0.15.2
PyYAML==3.12
requestbuilder==devel
requests==2.12.4
service-identity==18.1.0
setuptools==33.1.1
six==1.10.0
Twisted==19.2.0
urllib3==1.19.1
wheel==0.33.4
zope.interface==4.6.0
2. Install Protoc (Protocol Buffer Compiler)
wget \
https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip
root@athos:~# wget \
>https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip
--2019-05-22 12:57:26--
https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip
Resolving github.com (github.com)... 52.74.223.119
Connecting to github.com (github.com)|52.74.223.119|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
(truncated)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com
(github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.164.155|:443.. connected.
HTTP request sent, awaiting response... 200 OK
Length: 1379374 (1.3M) [application/octet-stream]
Saving to: ‘protoc-3.5.1-linux-x86_64.zip’
protoc-3.5.1-linux-x86_64.zip 100%[===========================>] 1.32M 917KB/s in 1.5s
2019-05-22 12:57:29 (917 KB/s) - ‘protoc-3.5.1-linux-x86_64.zip’ saved [1379374/1379374]
root@athos:~# unzip protoc-3.5.1-linux-x86_64.zip -d protoc/
Archive: protoc-3.5.1-linux-x86_64.zip
creating: protoc/include/
creating: protoc/include/google/
creating: protoc/include/google/protobuf/
inflating: protoc/include/google/protobuf/struct.proto
inflating: protoc/include/google/protobuf/type.proto
inflating: protoc/include/google/protobuf/descriptor.proto
inflating: protoc/include/google/protobuf/api.proto
inflating: protoc/include/google/protobuf/empty.proto
creating: protoc/include/google/protobuf/compiler/
inflating: protoc/include/google/protobuf/compiler/plugin.proto
inflating: protoc/include/google/protobuf/any.proto
inflating: protoc/include/google/protobuf/field_mask.proto
inflating: protoc/include/google/protobuf/wrappers.proto
inflating: protoc/include/google/protobuf/timestamp.proto
inflating: protoc/include/google/protobuf/duration.proto
inflating: protoc/include/google/protobuf/source_context.proto
creating: protoc/bin/
inflating: protoc/bin/protoc
inflating: protoc/readme.txt
root@athos:~# cat protoc/readme.txt
Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/
This package contains a precompiled binary version of the protocol buffer
compiler (protoc). This binary is intended for users who want to use Protocol
Buffers in languages other than C++ but do not want to compile protoc
themselves. To install, simply place this binary somewhere in your PATH.
If you intend to use the included well known types then don't forget to
copy the contents of the 'include' directory somewhere as well, for example
into '/usr/local/include/'.
Please refer to our official github site for more installation instructions:
https://github.com/google/protobuf
mv protoc/include/* /usr/local/include/
mv protoc/bin/protoc /usr/local/bin/
rm -rf protoc/
export PYTHONPATH=/root/certificate-transparency/python
env | grep PYTHONPATH
root@athos:~# mv protoc/include/* /usr/local/include/
root@athos:~# mv protoc/bin/protoc /usr/local/bin/
root@athos:~# rm -rf protoc/
root@athos:~# export PYTHONPATH=/root/certificate-transparency/python
root@athos:~# env | grep PYTHONPATH
PYTHONPATH=/root/certificate-transparency/python
root@athos:~# cd certificate-transparency/python/
root@athos:~/certificate-transparency/python# make
(truncated)
root@athos:~/certificate-transparency/python# make test
(truncated)
PASSED (successes=14)
PYTHONPATH=/root/certificate-transparency/python:. ./ct/client/async_log_client_test.py
ct.client.async_log_client_test
AsyncLogClientTest
test_get_entries ... [OK]
test_get_entries_fires_done_if_consumer_raises ... [OK]
test_get_entries_pause_resume ... [OK]
test_get_entries_raises_if_query_is_larger_than_tree_size ... [OK]
test_get_entries_raises_on_invalid_response ... [OK]
test_get_entries_raises_on_too_large_response ... [OK]
test_get_entries_returns_all_for_limiting_server ... [OK]
test_get_entries_returns_all_in_batches ... [OK]
test_get_entries_stores_entries ... [OK]
test_get_entries_succedes_after_retry ... [OK]
test_get_entries_tries_to_fetch_if_not_available_in_db ... [OK]
test_get_entries_use_stored_entries ... [OK]
test_get_sth ... [OK]
test_get_sth_consistency ... [OK]
test_get_sth_raises_on_invalid_base64 ... [OK]
test_get_sth_raises_on_invalid_response ... [OK]
ResponseBodyHandlerTest
test_buffer_overflow ... [OK]
test_send ... [OK]
test_send_chunks ... [OK]
-------------------------------------------------------------------------------
Ran 19 tests in 1.057s
PASSED (successes=19)
root@athos:~/certificate-transparency/python# ./ct/dashboard/dashboard.py
WARNING:root:Monitor state file not found, assuming first run.