Skip to content

Gpg Interface and Emails - #7996

Closed
tacruc wants to merge 26 commits into
nextcloud:masterfrom
tacruc:GPG-Email
Closed

tacruc wants to merge 26 commits into
nextcloud:masterfrom
tacruc:GPG-Email

Conversation

@tacruc

@tacruc tacruc commented Jan 22, 2018 •

Copy link
Copy Markdown
Contributor

With an interface there is functionallity for gpg added to use it where ever you want.
This interface is used to extend the Mailer, so that it is possible to send Gpg encrypted Emails.

  • Sending encrypted emails
  • Sending encrypted and signed emails
  • create nextcloud_data/.gnupg and server keys on setup or upgrade
  • allow users to upload public key
  • Gpg.php unit test
  • user.php unit test
  • DummyGpg to resolve hard dependency on gnupg
  • DummyGpg unit tests, is it needed?
  • update Message unit tests
  • Fix phar error
  • Fix checkers error
  • Add a ci runner with gnupg enabled
  • Add optional dependency on gnupg
  • Remove the Key input fields in the settings, if gnupg is not there

Pro Contra Core Implementation or as an app with an hook on mailer::send()

Because the discussion came up on irc and on help.nextcloud.com I would like to collect the arguments. This is not a finished list and I'm happy to collect more arguments on both sides to get the best solution.

Contra

  • propably more maintenance do to more code on serverside,
  • only few people uses gpg
  • maybe new external dependency for only a few users
    • a dummy class which is loaded when external dependency is not avalible could be implemeted to avoid this
  • ...

Pro

  • strate forward implementation and not a fix at the email output
  • in some cases a bedder workflow is possible
    • share by email dialog
      The app has to decide based on the email address, if the email should be encrypted or not. It could load the public key's from the contacts, and maybe (depending if the hook can provide the information, not clear to me) it could check if the contact is in a addressbook of the current user. But there is no simple way to give a feedback to the user if the email share is going to be encrypted or not. You could propably do some javascript hack to bring this information to the dialog, but the information for the encryption is going over a complitly different way than the email. Just to meet up in the and on the mailer:send hook.
  • Gpg as an backend can be used for more than just sign and encrypt emails
    • Encrypt Notes
    • Implement a serverside GPG assistens in mails (usefull when trusting the server more than the pc in a internetcoffee for example)
    • Vertfy and sign Files
    • easy to use in every app
    • ...
  • ...

This PR is a basement for more Ideas:

Issue: #7310 and the Community
https://help.nextcloud.com/t/gpg-encrypted-emails-for-nextcloud/26129/4

Contacts

import public key's form contacts vCard and allow to upload them to the vCard
Server PR: #7997
Contacts App PR: nextcloud/contacts#460

Use the key from the Contacts to encrypt "share by email" emails

still allot to do
Server Branch: https://github.com/tacruc/server/tree/GPG-Share-By-eMail

More key managment features

There is an app https://github.com/tacruc/keymanager providing more features, but I'm not a desinger or a HTML/Javascript person so help with the interface would be appriciated

  • Providing an overview over all key's
  • showing contacts connected to a key (only in the json file)
  • suggesting contacts to connect with an key (only in the json file)
  • deleting and revoking keys
  • much more ...

@tacruc

tacruc commented Jan 22, 2018

Copy link
Copy Markdown
Contributor Author

@georgehrke here is the PR of the first branch

This was referenced Jan 22, 2018
@tacruc

tacruc commented Jan 22, 2018 •

Copy link
Copy Markdown
Contributor Author

So allot of failings is due to ther merge commit 4e74cfc. I'm totaly failing in removing it.
Edit: Solved by rebasing on nextcloud/master

And in the @ since errors can I add @ since 14.0.0 or is there a dummy like @ since notclear.

@codecov

codecov Bot commented Jan 23, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #7996 into master will decrease coverage by 45.19%.
The diff coverage is 0%.

@@             Coverage Diff             @@
##             master   #7996      +/-   ##
===========================================
- Coverage      51.7%   6.51%   -45.2%     
- Complexity    25429   25499      +70     
===========================================
  Files          1598    1601       +3     
  Lines         95248   95591     +343     
  Branches       1376    1376              
===========================================
- Hits          49252    6225   -43027     
- Misses        45996   89366   +43370
Impacted Files Coverage Δ Complexity Δ
settings/templates/settings/admin/tipstricks.php 0% <0%> (ø) 0 <0> (ø) ⬇️
lib/private/Repair/NC14/CreateGpgServerKeys.php 0% <0%> (ø) 9 <9> (?)
settings/Controller/MailSettingsController.php 0% <0%> (-67.22%) 11 <0> (ø)
...rovisioning_api/lib/Controller/UsersController.php 0% <0%> (-81.89%) 127 <0> (+5)
...ings/templates/settings/personal/personal.info.php 0% <0%> (ø) 0 <0> (ø) ⬇️
lib/private/Settings/Personal/PersonalInfo.php 0% <0%> (ø) 30 <0> (ø) ⬇️
lib/private/Repair.php 0% <0%> (-31.82%) 19 <0> (ø)
lib/private/Settings/Admin/TipsTricks.php 0% <0%> (-83.34%) 4 <0> (ø)
lib/private/GpgDummy.php 0% <0%> (ø) 11 <11> (?)
lib/private/Server.php 1.56% <0%> (-83.69%) 285 <3> (+4)
... and 887 more

@tacruc

tacruc commented Jan 23, 2018

Copy link
Copy Markdown
Contributor Author

Could somebody pleas add the help needed label?

OK forgot about the new external dependency gnupg.

There is a second implementation which could use as external dependency https://github.com/pear/Crypt_GPG.
Which at the moment I'm using the fist one, but I think it shoudln't be to much work implementing the second one or supporting both. For nextcloud internal everything calls the IGpg class.

So which of the external dependency's is to one is to prefer?
And how can it be added to the nextcloud dependencys?

tacruc added 18 commits January 29, 2018 09:58
The IMessages now accepts an array of Key fingerprints to encrypt and
sing and the Mailer calls an encryption funktion on sending.

Added IMessage_sign() to sign the email
Signed-off-by: Arne Hamann <[email protected]>
and Signed when Public and Private key are provided. This is tested on
mailbox.org and Outlook with GPGOL as client.

Signatur of email works on gmail and mailbox.org but fails on outlook.

Signed-off-by: Arne Hamann <[email protected]>
email Text extraction with messageContentToString funktion.

Signed-off-by: Arne Hamann <[email protected]>
… personal

setting page. More keys can be saved and are shown in the page too, it
is not nice so I think i will remove the showing. The backend for
multiple keys is importanted for futher applications.

Signed-off-by: Arne Hamann <[email protected]>
messages update log message to not leak unencrypted messages..

Signed-off-by: Arne Hamann <[email protected]>
…Keys

and OCP\Gpg. IGpg interface can now handle nonempty phassphrases
Signed-off-by: Arne Hamann <[email protected]>
Removed l10n from Gpg class
Fixed Typo in server.php line 1417

Signed-off-by: Arne Hamann <[email protected]>
@tflidd

tflidd commented Feb 11, 2018

Copy link
Copy Markdown
Contributor

@jospoortvliet This is a first-time contributor seeking for help. Perhaps you can find somebody who could give a few hints and feedback if such an enhancement could be integrated in NC 14.

@rullzer

rullzer commented May 23, 2018

Copy link
Copy Markdown
Member

Hi @tacruc

first of all thanks for your contribution and thanks and sorry for the late reply.

@MorrisJobke and I have been discussing this and we don't think we want to merge this into the main server. It is a lot of extra code we'd have to test and maintain.

Would it be possible for you to see if we can at some points in the code add events or plugins so this can be handled in an app? That way we can nicely isolate all behavior.

Feel free to open an issue to discuss this in more details.

@rullzer rullzer closed this May 23, 2018
@tacruc

tacruc commented May 24, 2018

Copy link
Copy Markdown
Contributor Author

Hi @rullzer,
thanks for your reply. I already expected this answer and can understand it, looking at the number of people using GPG. But I would still like this feature.

My problem is a little bit, that I think the more code I move into an app, the less user friendly the behavior will get, because in the end one can't automate the decision which Email to encrypt and which key to use. This is a decision the user would have to make on the event triggering the email.

So I think the changes to the email Interface, to enable not only to pass an email as address, but to pass a optional key, would be nice to integrate it in the core of the server.
All the stuff handling the key's and the email encryption can then be handled by an app.

So the solution with the max needed changes to the core would be something like the dummyGPG interface. Which than triggers the app. On the other extreme it would be an encryption gateway hooked, to the email send function, and does the automate the decision based on known public key's for the email address. In this extreme the app woudn't know which user has triggered the email, so having one user importing an public key for alice would probably end up in every user sending encrypted emails to alice, which could be used to brake the email system, when a bad user imports random public keys for all known email addresses.

I would be willing to split the code into a server and an app part, but I think the boarder should be chosen wise. If your interested we could have a talk or I could join the next hack week to work out wich is the best line to split.

@jospoortvliet

Copy link
Copy Markdown
Member

@tacruc hey, if you still want to work on this, perhaps you join the conference so we can make some decisions? The hackweek would have been nice, too, of course - otherwise, just come to the next, there will be another before the end of the year for sure 🚀

@tacruc

tacruc commented Aug 12, 2018

Copy link
Copy Markdown
Contributor Author

@jospoortvliet I'm still interested in continuing and already thought about the conference, but I can't make it this time. But hopefully I can make it to the next Hack week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants