Anchor ====== .. image:: https://img.shields.io/pypi/v/anchor.svg :target: https://pypi.python.org/pypi/anchor/ :alt: Latest Version .. image:: https://img.shields.io/pypi/pyversions/anchor.svg :target: https://pypi.python.org/pypi/anchor/ :alt: Python Versions .. image:: https://img.shields.io/pypi/format/anchor.svg :target: https://pypi.python.org/pypi/anchor/ :alt: Format .. image:: https://img.shields.io/badge/license-Apache%202-blue.svg :target: https://git.openstack.org/cgit/openstack/anchor/plain/LICENSE :alt: License Anchor is an ephemeral PKI service that, based on certain conditions, automates the verification of CSRs and signs certificates for clients. The validity period can be set in the config file with hour resolution. Ideas behind Anchor =================== A critical capability within PKI is to revoke a certificate - to ensure that it is no longer trusted by any peer. Unfortunately research has demonstrated that the two typical methods of revocation (Certificate Revocation Lists and Online Certificate Status Protocol) both have failings that make them unreliable, especially when attempting to leverage PKI outside of web-browser software. Through the use of short-lifetime certificates Anchor introduces the concept of "passive revocation". By issuing certificates with lifetimes measured in hours, revocation can be achieved by simply not re-issuing certificates to clients. The benefits of using Anchor instead of manual long-term certificates are: * quick certificate revoking / rotation * always tested certificate update mechanism (used daily) * easy integration with certmonger for service restarting * certificates are signed only when validation is passed * signing certificates follows consistent process Installation ============ In order to install Anchor from source, the following system dependencies need to be present: * python 2.7 * python (dev files) * libffi (dev) * libssl (dev) When everything is in place, Anchor can be installed in one of three ways: a local development instance in a python virtual environment, a local production instance or a test instance in a docker container. For a development instance with virtualenv, run: virtualenv .venv && source .venv/bin/activate && pip install . For installing in production, either install a perpared system package, or install globally in the system: python setup.py install Running the service =================== In order to run the service, it needs to be started via the `pecan` application server. The only extra parameter is a config file: pecan serve config.py For development, an additional `--reload` parameter may be used. It will cause the service to reload every time a source file is changed, however it requires installing an additional `watchdog` python module. In the default configuration, Anchor will wait for web requests on port 5016 on local network interface. This can be adjusted in the `config.py` file. Preparing a test environment ============================ In order to test Anchor with the default configuration, the following can be done to create a test CA. The test certificate can be then used to sign the new certificates. openssl req -out CA/root-ca.crt -keyout CA/root-ca-unwrapped.key \ -newkey rsa:4096 -subj "/CN=Anchor Test CA" -nodes -x509 -days 365 chmod 0400 CA/root-ca-unwrapped.key Next, a new certificate request may be generated: openssl req -out anchor-test.example.com.csr -nodes \ -keyout anchor-test.example.com.key -newkey rsa:2048 \ -subj "/CN=anchor-test.example.com" That reqest can be submitted using curl (while `pecan serve config.py` is running): curl http://0.0.0.0:5016/v1/sign/default -F user='myusername' \ -F secret='simplepassword' -F encoding=pem \ -F 'csr=