6.1 KiB
Contributing
Hacking
In order to start hacking, you will first have to create a
development environment. Start by installing dependencies and setting up
Let's Encrypt <using>.
Now you can install the development packages:
./venv/bin/pip install -r requirements.txt -e .[dev,docs,testing]
The code base, including your pull requests, must
have 100% test statement coverage and be compliant with
the coding style
<coding-style>.
The following tools are there to help you:
./venv/bin/toxstarts a full set of tests. Please make sure you run it before submitting a new pull request../venv/bin/tox -e coverchecks the test coverage only../venv/bin/tox -e lintchecks the style of the whole project, while./venv/bin/pylint --rcfile=.pylintrc filewill check a singlefileonly.
Vagrant
If you are a Vagrant user, Let's Encrypt comes with a Vagrantfile
that automates setting up a development environment in an Ubuntu 14.04
LTS VM. To set it up, simply run vagrant up. The repository
is synced to /vagrant, so you can get started with:
vagrant ssh
cd /vagrant
./venv/bin/pip install -r requirements.txt
sudo ./venv/bin/letsencrypt
Support for other Linux distributions coming soon.
Note
Unfortunately, Python distutils and, by extension, setup.py and tox, use hard linking quite extensively. Hard linking is not supported by the default sync filesystem in Vagrant. As a result, all actions with these commands are significantly slower in Vagrant. One potential fix is to use NFS (related issue).
Code components and layout
- acme
-
contains all protocol specific code
- letsencrypt
-
all client code
Plugin-architecture
Let's Encrypt has a plugin architecture to facilitate support for different webservers, other TLS servers, and operating systems. The interfaces available for plugins to implement are defined in interfaces.py.
The most common kind of plugin is a "Configurator", which is likely to implement the ~letsencrypt.interfaces.IAuthenticator and ~letsencrypt.interfaces.IInstaller interfaces (though some Configurators may implement just one of those).
There are also ~letsencrypt.interfaces.IDisplay plugins, which implement bindings to alternative UI libraries.
Authenticators
Authenticators are plugins designed to solve challenges received from
the ACME server. From the protocol, there are essentially two different
types of challenges. Challenges that must be solved by individual
plugins in order to satisfy domain validation (subclasses of ~.DVChallenge, i.e. ~.challenges.DVSNI, ~.challenges.SimpleHTTPS, ~.challenges.DNS) and continuity specific
challenges (subclasses of ~.ContinuityChallenge, i.e. ~.challenges.RecoveryToken, ~.challenges.RecoveryContact, ~.challenges.ProofOfPossession). Continuity
challenges are always handled by the ~.ContinuityAuthenticator, while plugins are
expected to handle ~.DVChallenge types.
Right now, we have two authenticator plugins, the ~.ApacheConfigurator and the ~.StandaloneAuthenticator. The Standalone and
Apache authenticators only solve the ~.challenges.DVSNI challenge currently. (You
can set which challenges your authenticator can handle through the ~.IAuthenticator.get_chall_pref.
(FYI: We also have a partial implementation for a ~.DNSAuthenticator in a separate branch).
Installer
Installers classes exist to actually setup the certificate and be
able to enhance the configuration. (Turn on HSTS, redirect to HTTPS,
etc). You can indicate your abilities through the ~.IInstaller.supported_enhancements call. We
currently only have one Installer written (still developing), ~.ApacheConfigurator.
Installers and Authenticators will oftentimes be the same class/object. Installers and Authenticators are kept separate because it should be possible to use the ~.StandaloneAuthenticator (it sets up its own Python server to perform challenges) with a program that cannot solve challenges itself. (Imagine MTA installers).
Installer Development
There are a few existing classes that may be beneficial while developing a new ~letsencrypt.interfaces.IInstaller. Installers aimed to reconfigure UNIX servers may use Augeas for configuration parsing and can inherit from ~.AugeasConfigurator class to handle much of the interface. Installers that are unable to use Augeas may still find the ~.Reverter class helpful in handling configuration checkpoints and rollback.
Display
We currently offer a pythondialog and "text" mode for displays. Display plugins implement the ~letsencrypt.interfaces.IDisplay interface.
Coding style
Please:
Be consistent with the rest of the code.
Follow the Google Python Style Guide, with the exception that we use Sphinx-style documentation:
def foo(arg): """Short description. :param int arg: Some number. :returns: Argument :rtype: int """ return argRemember to use
./venv/bin/pylint.
Updating the documentation
In order to generate the Sphinx documentation, run the following commands:
cd docs
make clean html SPHINXBUILD=../venv/bin/sphinx-build
This should generate documentation in the
docs/_build/html directory.