Skip to main content

Sewer is a programmatic Lets Encrypt(ACME) client

Project description

Sewer

Codacy Badge

Sewer is a Let’s Encrypt(ACME) client.
It allows you to obtain ssl/tls certificates from Let’s Encrypt.
Sewer currently only supports the DNS mode of validation. The only currently supported DNS provider is cloudflare but I will add more as time progresses.

Installation:

pip install sewer

Usage:

import sewer

# 1. to create a new certificate:
client = sewer.Client(domain_name='example.com',
                      CLOUDFLARE_DNS_ZONE_ID='random',
                      CLOUDFLARE_EMAIL='example@example.com',
                      CLOUDFLARE_API_KEY='nsa-grade-api-key')
certificate = client.cert()
certificate_key = client.certificate_key
account_key = client.account_key

print "your certicate is:", certificate
print "your certificate's key is:", certificate_key
print "\n\n"
print "you can write them to a file then add that file to your favourite webserver."

with open('certificate.crt', 'w') as certificate_file:
    certificate_file.write(certificate)

with open('certificate.key', 'w') as certificate_key_file:
    certificate_key_file.write(certificate_key)

print "your account key is:", account_key
print "IMPORTANT: keep your account key in a very safe and secure place."

with open('account_key.key', 'w') as account_key_file:
    account_key_file.write(account_key)



# 2. to renew a certificate:
import sewer

with open('account_key.key', 'r') as account_key_file:
    account_key = account_key_file.read()

client = sewer.Client(domain_name='example.com',
                      CLOUDFLARE_DNS_ZONE_ID='random',
                      CLOUDFLARE_EMAIL='example@example.com',
                      CLOUDFLARE_API_KEY='nsa-grade-api-key',
                      account_key=account_key)
certificate = client.renew()
certificate_key = client.certificate_key

with open('certificate.crt', 'w') as certificate_file:
    certificate_file.write(certificate)

with open('certificate.key', 'w') as certificate_key_file:
    certificate_key_file.write(certificate_key)

TODO:

  • make it DNS provider agnostic

  • support more DNS providers

  • add robust tests

  • be able to handle SAN(subject alternative names)

  • add ci

FAQ:

  • Why another ACME client? I wanted an ACME client that I could use to programmatically(as a library) acquire/get certificates. However I could not find anything satisfactory for use in Python code.

  • Why is it called Sewer? Because, for the longest time now, getting certificates has felt like wading through sewers. That was before Let’s Encrypt showed up. Also, I really like the Kenyan hip hop artiste going by the name of Kitu Sewer.

Development setup

  • fork this repo.

  • cd sewer

  • sudo apt-get install pandoc

  • open an issue on this repo. In your issue, outline what it is you want to add and why.

  • install pre-requiste software: apt-get install pandoc && pip install twine wheel pypandoc coverage yapf flake8

  • make the changes you want on your fork.

  • your changes should have backward compatibility in mind unless it is impossible to do so.

  • add your name and contact(optional) to

  • add tests

  • run tests to make sure they are passing

  • format your code using yapf: yapf --in-place --style "google" -r .

  • run flake8 on the code and fix any issues: flake8 .

  • open a pull request on this repo.

NB: I make no commitment of accepting your pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sewer-0.0.4.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

sewer-0.0.4-py2-none-any.whl (9.2 kB view details)

Uploaded Python 2

File details

Details for the file sewer-0.0.4.tar.gz.

File metadata

  • Download URL: sewer-0.0.4.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sewer-0.0.4.tar.gz
Algorithm Hash digest
SHA256 eb165d4443fbd27d5209e460ab7a273261f35d85b0855d0c0e9e985fee2bcade
MD5 9563808adc368dfab09595ca00c45f0d
BLAKE2b-256 6c020be0ab3acf0c2b82f2ed54c780861bd4d2b5686d203db7a7dc84a8498803

See more details on using hashes here.

File details

Details for the file sewer-0.0.4-py2-none-any.whl.

File metadata

File hashes

Hashes for sewer-0.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 1009e1ec5f2c8642081a5f4366f5826b29df5b41ca7446911e52eb72094a41bd
MD5 6d407b3edbd1f1f9313037a0559fc499
BLAKE2b-256 d542a34d93dfd50d77d17fb05f6e4be7c8a6d890c3738d3b20e5209be453eb5b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page