PKlJP%hhlancer/__init__.py""" Provision TLS *Cer*tificates for your *LAN*, using the ACME DNS challenge. """ __version__ = '0.1' PKLoJw lancer/_impl.py import sys, os, json, six from secretly import secretly from functools import partial from twisted.internet.defer import Deferred from twisted.internet.task import react from twisted.python.filepath import FilePath from twisted.logger import globalLogBeginner, textFileLogObserver from cryptography.hazmat.primitives import serialization from cryptography.hazmat.backends import default_backend from acme.jose import JWKRSA, RS256 from txacme.service import AcmeIssuingService from txacme.store import DirectoryStore from txacme.client import Client from txacme.urls import LETSENCRYPT_DIRECTORY from txacme.util import generate_private_key from txacme.challenges import LibcloudDNSResponder def maybe_key(pem_path): acme_key_file = pem_path.child(u'client.key') if acme_key_file.exists(): key = serialization.load_pem_private_key( acme_key_file.getContent(), password=None, backend=default_backend() ) else: key = generate_private_key(u'rsa') acme_key_file.setContent( key.private_bytes( encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption() ) ) acme_key = JWKRSA(key=key) return acme_key def main(reactor): acme_path = FilePath(sys.argv[1]).asTextMode() myconfig = acme_path.child("lancer.json") if myconfig.exists(): cfg = json.loads(myconfig.getContent()) driver_name = cfg['driver_name'] zone_name = cfg['zone_name'] user_name = cfg['user_name'] else: driver_name = six.moves.input("driver ('rackspace' or 'cloudflare')? ") user_name = six.moves.input("user? ") zone_name = six.moves.input("zone? ") myconfig.setContent(json.dumps({ "driver_name": driver_name, "user_name": user_name, "zone_name": zone_name, }).encode("utf-8")) globalLogBeginner.beginLoggingTo([textFileLogObserver(sys.stdout)]) def action(secret): password = secret responders = [ LibcloudDNSResponder.create(reactor, driver_name, user_name, password, zone_name) ] acme_key = maybe_key(acme_path) cert_store = DirectoryStore(acme_path) client_creator = partial(Client.from_url, reactor=reactor, url=LETSENCRYPT_DIRECTORY, key=acme_key, alg=RS256) clock = reactor service = AcmeIssuingService(cert_store, client_creator, clock, responders) service.startService() forever = Deferred() return forever return secretly(reactor, action=action, system='libcloud/' + driver_name, username=user_name) def script(): react(main) PK!HT)0%lancer-0.1.dist-info/entry_points.txtN+I/N.,()IKN-RU03s r \\PK mJ$/00lancer-0.1.dist-info/LICENSEThe MIT License (MIT) Copyright (c) 2017 Glyph Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HIWdlancer-0.1.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q0343 /, (-JLR()*M ILR(4KM̫#DPK!H-y{tlancer-0.1.dist-info/METADATA]O=O0+nHB=*b:Ē Ϳ'Aw;bl1}%%Q% {E^+JZ'a[CROXB'atC- b} U Cco)R:`;옇 c[3]ljE}/cDs^ZPJoyn4BafƻO2 %Hyb3^|Fe2.6PK!H;xXlancer-0.1.dist-info/RECORDu϶B@}B,ŸI]#HCHEs+B Ƅq50M3M꼫=[M̺4#