-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add encrypting backend mixin and mix it in with Django's built-in backends #39
Open
blag
wants to merge
6
commits into
stephenmcd:master
Choose a base branch
from
blag:encrypting-backend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
345283f
to
a61cccb
Compare
@stephenmcd I'm now happy with this PR. Do you mind reviewing it? You might also be interested, @theithec. And I'd like to add tests to the repo. Do you mind if I tack them onto the end of this? Thanks! |
No time at the moment sorry. |
fd943ac
to
d197e18
Compare
6e3146f
to
ec1cf6a
Compare
Rebasing on master now that #41 is merged... |
Done rebasing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first attempt at this, so feedback and criticism is more than welcome!
This is extremely similar to
email_extras.utils.send_mail
, but it's a mixin for mail backends.The main problem I have with django-email-extras is that third-party app developers have to explicitly opt-in to using it by calling our
send_mail
function. I am using django-accounts and django-allauth to handle user registration/login/forgotten passwords, and they use Django's built-in one fromdjango.core.mail
.I think encryption should be as easy to implement and use as possible (while still remaining actually secure), so this is an attempt in that direction. With this backend configured all mail Django sends will be sent through this backend, and opportunistically encrypted along the way (if the user has uploaded a key).
I also mixed it in with Django's built-in backends, so there's
Encrypting*EmailBackend
for theConsole
,Locmem
,Filebased
, andSmtp
backends.I am explicitly not adding code to upload the key to keyservers because python-gnupg does not yet support generating key revocation certificates, so I don't want users to upload keys they can't easily revoke.I added code to the newemail_signing_key
management command to automatically upload the key to one of more specified keyservers.TODO:
SIGNING_KEY_FINGERPRINT
specified a key that doesn't existEMAIL_EXTRAS_SIGNING_KEY_DATA
Fire up server, browse to admin for keysHit the "Generate signing key" buttonRun theemail_signing_key
command to generate a signing keyEMAIL_EXTRAS_SIGNING_KEY_FINGERPRINT
to copied fingerprintEdit: Thought of more/better ways to go about things.