From 2db2f4b6fc2bc71c498a47848bbe40e49184490e Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Tue, 24 Oct 2017 14:39:16 +1100 Subject: [PATCH] Add support for /.well-known/keybase.txt --- lemoncurry/settings/base.py | 1 + lemoncurry/urls.py | 1 + wellknowns/__init__.py | 1 + wellknowns/apps.py | 5 +++ wellknowns/static/wellknowns/keybase.txt | 54 ++++++++++++++++++++++++ wellknowns/urls.py | 8 ++++ wellknowns/views.py | 9 ++++ 7 files changed, 79 insertions(+) create mode 100644 wellknowns/__init__.py create mode 100644 wellknowns/apps.py create mode 100644 wellknowns/static/wellknowns/keybase.txt create mode 100644 wellknowns/urls.py create mode 100644 wellknowns/views.py diff --git a/lemoncurry/settings/base.py b/lemoncurry/settings/base.py index 294f994..d31461e 100644 --- a/lemoncurry/settings/base.py +++ b/lemoncurry/settings/base.py @@ -68,6 +68,7 @@ INSTALLED_APPS = [ 'lemoncurry', 'home', 'users', + 'wellknowns', ] MIDDLEWARE = [ diff --git a/lemoncurry/urls.py b/lemoncurry/urls.py index 311d6d7..2a8662f 100644 --- a/lemoncurry/urls.py +++ b/lemoncurry/urls.py @@ -18,5 +18,6 @@ from django.contrib import admin urlpatterns = [ url(r'^', include('home.urls')), + url(r'^.well-known/', include('wellknowns.urls')), url(r'^admin/', admin.site.urls), ] diff --git a/wellknowns/__init__.py b/wellknowns/__init__.py new file mode 100644 index 0000000..8e7b63d --- /dev/null +++ b/wellknowns/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wellknowns.apps.WellKnownsConfig' diff --git a/wellknowns/apps.py b/wellknowns/apps.py new file mode 100644 index 0000000..08ba250 --- /dev/null +++ b/wellknowns/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class WellKnownsConfig(AppConfig): + name = 'wellknowns' diff --git a/wellknowns/static/wellknowns/keybase.txt b/wellknowns/static/wellknowns/keybase.txt new file mode 100644 index 0000000..950dde7 --- /dev/null +++ b/wellknowns/static/wellknowns/keybase.txt @@ -0,0 +1,54 @@ +================================================================== +https://keybase.io/00dani +-------------------------------------------------------------------- + +I hereby claim: + + * I am an admin of https://00dani.me + * I am 00dani (https://keybase.io/00dani) on keybase. + * I have a public key ASC87RGG0JA9ofKNB8AJMIT7gfEHAosltGkVw9hFpQzXkwo + +To do so, I am signing this object: + +{ + "body": { + "key": { + "eldest_kid": "0120bced1186d0903da1f28d07c0093084fb81f107028b25b46915c3d845a50cd7930a", + "host": "keybase.io", + "kid": "0120bced1186d0903da1f28d07c0093084fb81f107028b25b46915c3d845a50cd7930a", + "uid": "fe1e0c96654603c5880b3f571c862919", + "username": "00dani" + }, + "service": { + "hostname": "00dani.me", + "protocol": "https:" + }, + "type": "web_service_binding", + "version": 1 + }, + "client": { + "name": "keybase.io go client", + "version": "1.0.18" + }, + "ctime": 1486502471, + "expire_in": 504576000, + "merkle_root": { + "ctime": 1486502388, + "hash": "7fbc86be65b5e09c41f90a2a986c22c6cba0bec0adc73b3cde38a7f4f53ceb4719fbbad968e65cd77aedd74598fc9f75cec52e5dc337feb35b3359f3ea6a9f0d", + "seqno": 840853 + }, + "prev": "247226586c012bd704ba62b97e97dc2113604b4e84eb9784ad886887c9ca6e7e", + "seqno": 33, + "tag": "signature" +} + +which yields the signature: + +hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgvO0RhtCQPaHyjQfACTCE+4HxBwKLJbRpFcPYRaUM15MKp3BheWxvYWTFAvB7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwYmNlZDExODZkMDkwM2RhMWYyOGQwN2MwMDkzMDg0ZmI4MWYxMDcwMjhiMjViNDY5MTVjM2Q4NDVhNTBjZDc5MzBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwYmNlZDExODZkMDkwM2RhMWYyOGQwN2MwMDkzMDg0ZmI4MWYxMDcwMjhiMjViNDY5MTVjM2Q4NDVhNTBjZDc5MzBhIiwidWlkIjoiZmUxZTBjOTY2NTQ2MDNjNTg4MGIzZjU3MWM4NjI5MTkiLCJ1c2VybmFtZSI6IjAwZGFuaSJ9LCJzZXJ2aWNlIjp7Imhvc3RuYW1lIjoiMDBkYW5pLm1lIiwicHJvdG9jb2wiOiJodHRwczoifSwidHlwZSI6IndlYl9zZXJ2aWNlX2JpbmRpbmciLCJ2ZXJzaW9uIjoxfSwiY2xpZW50Ijp7Im5hbWUiOiJrZXliYXNlLmlvIGdvIGNsaWVudCIsInZlcnNpb24iOiIxLjAuMTgifSwiY3RpbWUiOjE0ODY1MDI0NzEsImV4cGlyZV9pbiI6NTA0NTc2MDAwLCJtZXJrbGVfcm9vdCI6eyJjdGltZSI6MTQ4NjUwMjM4OCwiaGFzaCI6IjdmYmM4NmJlNjViNWUwOWM0MWY5MGEyYTk4NmMyMmM2Y2JhMGJlYzBhZGM3M2IzY2RlMzhhN2Y0ZjUzY2ViNDcxOWZiYmFkOTY4ZTY1Y2Q3N2FlZGQ3NDU5OGZjOWY3NWNlYzUyZTVkYzMzN2ZlYjM1YjMzNTlmM2VhNmE5ZjBkIiwic2Vxbm8iOjg0MDg1M30sInByZXYiOiIyNDcyMjY1ODZjMDEyYmQ3MDRiYTYyYjk3ZTk3ZGMyMTEzNjA0YjRlODRlYjk3ODRhZDg4Njg4N2M5Y2E2ZTdlIiwic2Vxbm8iOjMzLCJ0YWciOiJzaWduYXR1cmUifaNzaWfEQLHcXK1/BmBNEcwKl8sw2RIShjZkL15+rqNbHd4RXb6OjAAvoug0pCZWFU2NoG8chttm+U6WW3mADOwHGy5HqwCoc2lnX3R5cGUgpGhhc2iCpHR5cGUIpXZhbHVlxCAovpeXiCcQcquE0p+VhDOjdJpxwKlVWElcn4oSMliIDKN0YWfNAgKndmVyc2lvbgE= + +And finally, I am proving ownership of this host by posting or +appending to this document. + +View my publicly-auditable identity here: https://keybase.io/00dani + +================================================================== diff --git a/wellknowns/urls.py b/wellknowns/urls.py new file mode 100644 index 0000000..f33e902 --- /dev/null +++ b/wellknowns/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls import url + +from . import views + +app_name = 'wellknowns' +urlpatterns = [ + url(r'^keybase.txt$', views.keybase, name='keybase'), +] diff --git a/wellknowns/views.py b/wellknowns/views.py new file mode 100644 index 0000000..4dfab5b --- /dev/null +++ b/wellknowns/views.py @@ -0,0 +1,9 @@ +from django.views.generic.base import RedirectView +from django.contrib.staticfiles.templatetags.staticfiles import static + + +def redirect_to_static(file): + return RedirectView.as_view(url=static('wellknowns/' + file)) + + +keybase = redirect_to_static('keybase.txt')