Coder Social home page Coder Social logo

urda / django-letsencrypt Goto Github PK

View Code? Open in Web Editor NEW
70.0 4.0 9.0 334 KB

A simple Django app to handle Let's Encrypt ACME challenges

Home Page: https://pypi.org/project/django-letsencrypt/

License: Apache License 2.0

Python 83.89% HTML 2.17% Makefile 12.82% Shell 1.12%
python letsencrypt django

django-letsencrypt's Introduction

Let's Encrypt App for Django

django-letsencrypt will allow you to add, remove, and update any ACME challenge objects you may need through your Django admin interface. Simply add the ACME challenge and response for your app to serve up the necessary information for Let's Encrypt validation.

This project strives to make installation, configuration, and usage a snap! From high levels of code coverage, multiple compatible python versions, multiple versions of Django supported, even multiple databases too!

And of course all wrapped up and published to PyPI for standard installation!

Supported Configurations

django-letsencrypt is tested across a number of configurations, here's what's supported so far:

  • Python Versions Supported:
    • 3.10 (Django 4.0 and 3.2 only)
    • 3.9 (Django 4.0 and 3.2 only)
    • 3.8
    • 3.7 (Django 3.2 and 2.2 only)
  • Django Versions Supported:
    • 4.0 minimum version 4.0
    • 3.2 minimum version 3.2.10
    • 2.2 minimum version 2.2.25
  • Databases Supported:
    • mysql
    • postgres
    • sqlite

Recent Build Status Badges

  • Linting - Master
  • Testing Django 2.2 - Master
  • Testing Django 3.2 - Master
  • Testing Django 4.0 - Master
  • Codecov - Master

Installation & Configuration

  1. pip install django-letsencrypt

  2. Add letsencrypt to your INSTALLED_APPS

INSTALLED_APPS = [
   ... ,
   'letsencrypt',
   ... ,
]
  1. Include the letsencrypt in your project's urls.py, or where applicable (usually your root urls.py).
re_path(r'^\.well-known/', include('letsencrypt.urls'))
  1. Run manage.py migrate to create the required table for the letsencrypt model

  2. Create your ACME Challenge objects in your Django admin interface

  3. Test your ACME Challenge objects and their responses by visiting them:

{Django Site}/.well-known/acme-challenge/challenge_text
  1. Enjoy your easy to manage ACME Challenges inside your Django project!

Example Project

If you would like a demo of how to use this application simply clone this project's git repository from GitHub, take a moment to read the README.md file within the example_project directory, and follow the directions. That will spin up a small sample django application already configured for you to try out.

django-letsencrypt's People

Contributors

michael-k avatar paolodina avatar petercuret avatar urda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-letsencrypt's Issues

Minimum requirements

django-letsencrypt forces django to update when installing. Can you set a minimum requirement?

Investigate (and possibly integrate) tox into the project.

During work on PR #59 , it was discovered that the make test that is ran locally on a developer's machine will never report full coverage due to a recent import change required in Django 2.0.

It looks like it is time to start using / integrate tox into the project to handle all the different Django and python versions that Travis CI is targeting.

Support final version of 2.1

With the release of Django 2.2, Django 2.1 has reached the end of mainstream support. The final minor bug fix release, 2.1.8, was issued today. Django 2.1 will receive security and data loss fixes until December 2019. All users are encouraged to upgrade before then to continue receiving fixes for security issues.

Screenshot_2019-04-01 Download Django Django

Sunset Python 2

This project will be dropping support for python 2 sometime soon. This will result in a "version bump" of the project, with support for python 2 removed.

Support Django 2.2

See also: Django 2.2 released @ djangoproject.com.

With the release of Django 2.2, Django 2.1 has reached the end of mainstream support. The final minor bug fix release, 2.1.8, was issued today. Django 2.1 will receive security and data loss fixes until December 2019. All users are encouraged to upgrade before then to continue receiving fixes for security issues.

Sunset Django 1.8

Problem

Django 1.8 support ended on April 1, 2018. This project will be dropping support for that version.

Current

Current Django versions supported

Future

Future Django versions supported

COVID RE-Plan

Good lord 2020 is awful isn't it?

I've got a list of housekeeping, build changes, and updates to do. Taking this odd time in history to close those linger issues, and start a re-plan.

Once I have work in motion on that, I'll close this out.

Sunset Django 1.10

Problem

Django 1.10 support will be ending December 2017. At that time, this project will be dropping support for those versions.

Current

current_supported_releases

Future

future_releases

multi site configuration

This is a question rather than a bug. We are hosting multiple domains from our website. If I understand correctly, our app needs to generate challenge / response tokens (or manually through the backend) so that letsencrypt can validate. How does one go about requesting the certificate? Via the commandline tool? I would like to think there is an automated way of generating and renewing these through Django somehow.

How to migrate from 1.0.8 to 2.0.0?

I am getting:

Applying letsencrypt.0001_squashed_0004_squash_for_mysql_support...Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 97, in database_forwards
    schema_editor.create_model(model)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 303, in create_model
    self.execute(sql, params or None)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 120, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 80, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/raven/contrib/django/client.py", line 114, in execute
    return real_execute(self, sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 63, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "letsencrypt_acmechallenge" already exists

Any way to fix it without reapplying all migrations?

ValueError during pip install

Starting with django-letsencrypt version 2.0.0, a pip install fails where version 1.1.1 doesn't fail

OS : Linux version 3.16.0-4-amd64 ([email protected]) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19)

Error:
ValueError: ("Expected ',' or end-of-list in", 'Django >=1.8.18,!=1.9.', 'at', '')
This is on a fresh VM with python 2.7 and Django 1.11.7 installed immediately prior

Version Sync for 2020

Django 3.0 came out, and this project needs to sync up with versions and verify things are still working as expected.

I'll be using this issue to track the overall progress of this task.

Sync with Django Roadmap

The project should sync with the current Django roadmap and make sure the latest versions are being targeted as expected.

Investigate using Docker for example_project

Instead of standing up a virtualenv and configuring a local environment just to checkout the example_project, it may be worthwhile to investigate moving to a docker based solution.

Drop support for all Django versions prior to 2.2

https://docs.djangoproject.com/en/3.0/releases/3.0/#third-party-library-support-for-older-version-of-django

Third-party library support for older version of Django

Following the release of Django 3.0, we suggest that third-party app authors drop support for all versions of Django prior to 2.2. At that time, you should be able to run your package’s tests using python -Wd so that deprecation warnings appear. After making the deprecation warning fixes, your app should be compatible with Django 3.0.

Drop Django 1.9 Support

The Django project will be ending 1.9 support in April 2017 and releasing 1.11 LTS. It may be in the project's best interest to have the 2.x release support those versions going forward. Basically, 2.x will not support the Django 1.9 releases. Since a 2.x release is around the corner, now would be a great time to plan for dropping it.

Sources

screenshot 2017-03-21 20 47 22

Nothing in admin interface

How this really works? I mean I don't see anything related to letsencrypt inside admin.

Django 1.11

UPDATE:
I did migrate and got this -

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, letsencrypt, sessions
Running migrations:
  Applying letsencrypt.0001_squashed_0004_squash_for_mysql_support... OK

Does it work with postgresql?

how to configure requests and response?

Admin interface seems working now. But how to configure it?

CMD:
sudo letsencrypt certonly -a webroot --webroot-path=/var/www/html -d example.net -d www.example.net -d ins.example.net

Admin interface
image

console print

IMPORTANT NOTES:

README link needs updated

Currently, we link to https://letsencrypt.github.io/acme-spec/ in README.rst, but that displays the following when opened:

NOTE: This Repository is Deprecated

This repository is not active and does not accurately reflect what Let's Encrypt currently implements. It's retained only for history.

All new work happens here: https://github.com/ietf-wg-acme/acme/ 

The README file should be updated in reference to this notice.

Thank you to @michaelfrance for reporting this issue.

Django 1.10 - sys.modules issue

When following the installation instructions on pypi and using Gunicorn to run my Django app, my urls.py reference to letsencrypt.urls fails.

screen shot 2017-04-03 at 18 27 00

Having a look at __init__py, this line seems strange

sys.modules['letsencrypt'] = certbot

I haven't been able to make sense of this. Since certbot is installed as a dependency, the certbot binary is available in the pip context on the command line. So now, letsencrypt and certbot point to the same module as far as sys is concerned.

As a result, it seems that Gunicorn picks up letsencrypt as certbot and can't find a urls module linked to the letsencrypt package. So, it's failing the import.

Why set the letsencrypt sys.module equal to certbot? Wouldn't it be better just to leave it as is and have people access certbot directly?

MySQL support problems

Looks like we need to see about moving from TextField to CharField on the model.

Strategy to deal with this:

  • Accept merge, with mysql as an allowed failure (PR #9)
  • Update Model for mysql (PR #10):
    • Create new columns, copy data
    • Change primary key column
    • Remove old columns
  • Enable mysql testing (PR #10)

Traceback

Travis Build

Creating test database for alias 'default'...
Traceback (most recent call last):
  File "runtests.py", line 72, in <module>
    failures = test_runner.run_tests(['letsencrypt'])
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
    old_config = self.setup_databases()
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
    **kwargs
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 368, in create_test_db
    test_flush=not keepdb,
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/migration.py", line 115, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/migrations/operations/fields.py", line 201, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 484, in alter_field
    old_db_params, new_db_params, strict)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 665, in _alter_field
    self.execute(self._create_unique_sql(model, [new_field.column]))
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 111, in execute
    cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
    raise errorvalue
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'challenge' used in key specification without a key length")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.