2015-07-12 19:22:10 +00:00
|
|
|
Certidude
|
|
|
|
=========
|
|
|
|
|
2015-07-26 20:34:46 +00:00
|
|
|
Introduction
|
|
|
|
------------
|
|
|
|
|
|
|
|
Certidude is a novel X.509 Certificate Authority management tool
|
|
|
|
with privilege isolation mechanism aiming to
|
|
|
|
eventually support PKCS#11 and in far future WebCrypto.
|
|
|
|
|
|
|
|
|
|
|
|
Features
|
|
|
|
--------
|
|
|
|
|
|
|
|
* Standard request, sign, revoke workflow via web interface.
|
2015-08-13 08:11:08 +00:00
|
|
|
* Colored command-line interface, check out ``certidude list``.
|
|
|
|
* OpenVPN integration, check out ``certidude setup openvpn server`` and ``certidude setup openvpn client``.
|
|
|
|
* strongSwan integration, check out ``certidude setup strongswan server`` and ``certidude setup strongswan client``.
|
2015-07-26 20:34:46 +00:00
|
|
|
* Privilege isolation, separate signer process is spawned per private key isolating
|
|
|
|
private key use from the the web interface.
|
|
|
|
* Certificate numbering obfuscation, certificate serial numbers are intentionally
|
|
|
|
randomized to avoid leaking information about business practices.
|
2015-08-13 08:11:08 +00:00
|
|
|
* Server-side events support via for example nginx-push-stream-module.
|
2015-07-26 20:34:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
TODO
|
|
|
|
----
|
|
|
|
|
|
|
|
* Refactor mailing subsystem and server-side events to use hooks.
|
|
|
|
* Notifications via e-mail.
|
|
|
|
* OCSP support.
|
|
|
|
* Deep mailbox integration, eg fetch CSR-s from mailbox via IMAP.
|
|
|
|
* WebCrypto support, meanwhile check out `hwcrypto.js <https://github.com/open-eid/hwcrypto.js>`_.
|
|
|
|
* Certificate push/pull, making it possible to sign offline.
|
|
|
|
* PKCS#11 hardware token support for signatures at command-line.
|
|
|
|
|
2015-07-12 19:22:10 +00:00
|
|
|
|
|
|
|
Install
|
|
|
|
-------
|
|
|
|
|
|
|
|
To install Certidude:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2015-08-13 08:11:08 +00:00
|
|
|
apt-get install -y python3 python3-netifaces python3-pip python3-dev cython3 build-essential libffi-dev libssl-dev
|
2015-07-12 19:22:10 +00:00
|
|
|
pip3 install certidude
|
2015-08-13 08:11:08 +00:00
|
|
|
|
|
|
|
Create a system user for ``certidude``:
|
2015-07-27 12:30:50 +00:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2015-08-13 08:11:08 +00:00
|
|
|
adduser --system --no-create-home --group certidude
|
2015-07-27 12:30:50 +00:00
|
|
|
|
2015-07-12 19:22:10 +00:00
|
|
|
|
|
|
|
Setting up CA
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Certidude can set up CA relatively easily:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2015-07-26 20:34:46 +00:00
|
|
|
certidude setup authority /path/to/directory
|
2015-07-12 19:22:10 +00:00
|
|
|
|
|
|
|
Tweak command-line options until you meet your requirements and
|
2015-07-26 20:34:46 +00:00
|
|
|
then insert generated section to your /etc/ssl/openssl.cnf
|
2015-07-12 19:22:10 +00:00
|
|
|
|
2015-08-13 08:11:08 +00:00
|
|
|
Spawn the signer process:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
certidude spawn
|
|
|
|
|
2015-07-12 19:22:10 +00:00
|
|
|
Finally serve the certificate authority via web:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
certidude serve
|
2015-07-26 20:34:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
Certificate management
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Use following command to request a certificate on a machine:
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
certidude setup client http://certidude-hostname-or-ip:perhaps-port/api/ca-name/
|
|
|
|
|
|
|
|
Use following to list signing requests, certificates and revoked certificates:
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
certidude list
|
|
|
|
|
|
|
|
Use web interface or following to sign a certificate on Certidude server:
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
certidude sign client-hostname-or-common-name
|
|
|
|
|
|
|
|
|
2015-07-27 12:30:50 +00:00
|
|
|
Production deployment
|
|
|
|
---------------------
|
|
|
|
|
2015-07-27 15:49:50 +00:00
|
|
|
Install uWSGI:
|
2015-07-27 12:30:50 +00:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
apt-get install uwsgi uwsgi-plugin-python3
|
|
|
|
|
2015-08-13 08:11:08 +00:00
|
|
|
To set up ``nginx`` and ``uwsgi`` is suggested:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
certidude setup production
|
|
|
|
|
|
|
|
Otherwise manually configure uUWSGI application in ``/etc/uwsgi/apps-available/certidude.ini``:
|
2015-07-27 12:30:50 +00:00
|
|
|
|
|
|
|
.. code:: ini
|
|
|
|
|
|
|
|
[uwsgi]
|
|
|
|
master = true
|
|
|
|
processes = 1
|
|
|
|
vaccum = true
|
|
|
|
uid = certidude
|
|
|
|
gid = certidude
|
|
|
|
plugins = python34
|
|
|
|
pidfile = /run/certidude/api/uwsgi.pid
|
|
|
|
socket = /run/certidude/api/uwsgi.sock
|
|
|
|
chdir = /tmp
|
|
|
|
module = certidude.wsgi
|
|
|
|
callable = app
|
|
|
|
chmod-socket = 660
|
|
|
|
chown-socket = certidude:www-data
|
2015-07-27 15:49:50 +00:00
|
|
|
env = CERTIDUDE_EVENT_PUBLISH=http://localhost/event/publish/%(channel)s
|
|
|
|
env = CERTIDUDE_EVENT_SUBSCRIBE=http://localhost/event/subscribe/%(channel)s
|
2015-07-27 12:30:50 +00:00
|
|
|
|
|
|
|
Also enable the application:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
ln -s ../apps-available/certidude.ini /etc/uwsgi/apps-enabled/certidude.ini
|
2015-07-26 20:34:46 +00:00
|
|
|
|
|
|
|
We support `nginx-push-stream-module <https://github.com/wandenberg/nginx-push-stream-module>`_,
|
2015-07-27 12:30:50 +00:00
|
|
|
configure the site in /etc/nginx/sites-available.d/certidude:
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
upstream certidude_api {
|
2015-07-27 15:49:50 +00:00
|
|
|
server unix:///run/certidude/api/uwsgi.sock;
|
2015-07-27 12:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
server_name localhost;
|
|
|
|
listen 80 default_server;
|
|
|
|
listen [::]:80 default_server ipv6only=on;
|
|
|
|
|
|
|
|
location ~ /event/publish/(.*) {
|
|
|
|
allow 127.0.0.1; # Allow publishing only from this IP address
|
|
|
|
push_stream_publisher admin;
|
|
|
|
push_stream_channels_path $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ /event/subscribe/(.*) {
|
|
|
|
push_stream_channels_path $1;
|
|
|
|
push_stream_subscriber long-polling;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
include uwsgi_params;
|
|
|
|
uwsgi_pass certidude_api;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Enable the site:
|
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
|
|
|
ln -s ../sites-available.d/certidude.ini /etc/nginx/sites-enabled.d/certidude
|
|
|
|
|
|
|
|
Also adjust ``/etc/nginx/nginx.conf``:
|
2015-07-26 20:34:46 +00:00
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
user www-data;
|
|
|
|
worker_processes 4;
|
|
|
|
pid /run/nginx.pid;
|
|
|
|
|
|
|
|
events {
|
2015-07-27 15:49:50 +00:00
|
|
|
worker_connections 768;
|
|
|
|
# multi_accept on;
|
2015-07-26 20:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
push_stream_shared_memory_size 32M;
|
2015-07-27 15:49:50 +00:00
|
|
|
sendfile on;
|
|
|
|
tcp_nopush on;
|
|
|
|
tcp_nodelay on;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
types_hash_max_size 2048;
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
access_log /var/log/nginx/access.log;
|
|
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
gzip on;
|
|
|
|
gzip_disable "msie6";
|
|
|
|
include /etc/nginx/sites-enabled/*;
|
2015-07-26 20:34:46 +00:00
|
|
|
}
|
|
|
|
|
2015-07-27 12:30:50 +00:00
|
|
|
Restart the services:
|
2015-07-26 20:34:46 +00:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2015-07-27 12:30:50 +00:00
|
|
|
service uwsgi restart
|
|
|
|
service nginx restart
|