diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..89302d5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:2.7 +RUN pip install pecan +ADD . /code +WORKDIR /code +RUN pip install -e . +RUN 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 +RUN chmod 0400 CA/root-ca-unwrapped.key +ENTRYPOINT ["pecan", "serve", "/code/config.py"] diff --git a/Dockerfile.anchorbase b/Dockerfile.anchorbase deleted file mode 100644 index c18071c..0000000 --- a/Dockerfile.anchorbase +++ /dev/null @@ -1,33 +0,0 @@ -FROM openstacksecurity/anchor:base -# According to http://crosbymichael.com/dockerfile-best-practices-take-2.html -# Rolling your own python base is in line with probably best practice -MAINTAINER Robert Clark - -# Clone our repo -# Users may want to use --no-cache to ensure that when building the container -# an up to date version of Anchor is cloned. -WORKDIR /root -RUN git clone git://git.openstack.org/openstack/anchor -WORKDIR /root/anchor - -RUN pip install -e . - -RUN cp config.py /home/anchor/ ;\ - cp config.json /home/anchor/ ;\ - chown anchor:anchor /home/anchor/config.py ;\ - chown anchor:anchor /home/anchor/config.json - -RUN su - anchor - -WORKDIR /home/anchor -RUN mkdir CA -RUN 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 - -ENTRYPOINT ["/usr/local/bin/pecan", "serve", "/home/anchor/config.py"] diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu deleted file mode 100644 index 4a099f0..0000000 --- a/Dockerfile.ubuntu +++ /dev/null @@ -1,37 +0,0 @@ -FROM ubuntu:latest -MAINTAINER Robert Clark - -# root user operations -# Upgrade the base and install required packages -RUN apt-get update && apt-get install -y \ - python-dev \ - libssl-dev \ - libffi-dev \ - python-pip \ - git - -# Clone Anchor, install required python packages -# Setup a user to run anchor -WORKDIR /root -RUN git clone git://git.openstack.org/openstack/anchor -WORKDIR /root/anchor -RUN pip install -e . -RUN adduser --disabled-password --gecos '' anchor - -# anchor user operations -RUN cp config.py /home/anchor/ -RUN cp config.json /home/anchor/ -RUN chown anchor:anchor /home/anchor/config.py -RUN chown anchor:anchor /home/anchor/config.json -RUN su - anchor -WORKDIR /home/anchor -RUN mkdir CA -RUN 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 -RUN chmod 0400 CA/root-ca-unwrapped.key -ENTRYPOINT ["/usr/local/bin/pecan", "serve", "/home/anchor/config.py"] diff --git a/README.md b/README.md index 40d78e2..7338652 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,20 @@ 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. +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. +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: +The benefits of using Anchor instead of manual long-term certificates +are: * quick certificate revoking / rotation * always tested certificate update mechanism (used daily) @@ -29,47 +32,48 @@ The benefits of using Anchor instead of manual long-term certificates are: Installation ============ -In order to install Anchor from source, the following system dependencies need -to be present: +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. For -development with virtualenv, run: +When everything is in place, Anchor can be installed in one of three +ways. For development 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: +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: +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. +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 5000 on -local network interface. This can be adjusted in the `config.py` file. +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. +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 @@ -81,127 +85,109 @@ Next, a new certificate request may be generated: -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): +That reqest can be submitted using curl (while `pecan serve config.py` +is running): - curl http://0.0.0.0:5000/v1/sign/default -F user='myusername' \ + curl http://0.0.0.0:5016/v1/sign/default -F user='myusername' \ -F secret='simplepassword' -F encoding=pem \ -F 'csr=