mirror of
https://github.com/d3cod3/EndtoEndEncryptedMailServer.git
synced 2026-04-26 09:25:52 +03:00
[GH-ISSUE #1] Where Are the emails stored #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dagogodboss on GitHub (Aug 19, 2020).
Original GitHub issue: https://github.com/d3cod3/EndtoEndEncryptedMailServer/issues/1
very Class, thanks a Lot
Where is the email store for each user because I created a new user and I can't find the user folder on the machine using the SQL method
@d3cod3 commented on GitHub (Aug 23, 2020):
Hi, if you check dovecot conf at
/etc/dovecot/dovecot-sql.confyou'll find the mailstore root:where
/your_mailstore_pathis your mailstore folder encrypted with gocrypt ( the first step after the DNS records )So, the mailstore root is the one you configured from the beginning.
@dagogodboss commented on GitHub (Aug 23, 2020):
yes yes I saw it later But creating a new Account from a PHP code seems to be conflicting cause the PHP code has to be using the root user which I don't think is secure anymore. Do you have a snippet to create and retrieve email accounts and folder with PHP?
And Finally, this part does work
Folder Not or file Not found when I change user it say permission error
@d3cod3 commented on GitHub (Aug 26, 2020):
About the PHP issue, yes, if you're working on some kind of web interface to interact with the mail server, it's delicate and you'll need to thread lightly, everything can became a security issue, especially for this kind of infrastructure where security is at the core of the idea.
So, a snippet with root privileges is to be completely avoided here, you'll have to think more of some kind of protocol, isolating the different parts of new user creation process, or user mail listing process.
You have this scenario:
on one side you'll need the typical registration form, users will need to enter the email alias, a password, and their public key ( you'll have to choose here the strategy for gpg keypair creation, leaving the job to the user or think about some automatism, but that will be tricky too ). Then you'll add this data to the PostgreSQL database, no problem here.
on the other side, we have all the automatic encryption stuff, and that works with an unprivileged user named gpgit, and here we have a problem, because gpgit is the only user with access to encryption, but you'll need to call the commands from sudo for security, so those commands can't be called from a PHP script without root privileges. Changing this to a less restricted configuration will lead to a possible vulnerability, accessing the public keys could lead to service disruption, if public keys disappears, messages will be unreadable or not encrypted anymore, or if public keys are mixed, no user will be able to read their messages, at least momentarily.
So, to solve this you'll need to be creative, i'm thinking at crontab, running a script every minute for example, let me explain:
imagine that the registration form add the new user to the database and add the entry in some text file ( .ini, .xml, .json, you choose ), some kind of waiting list file with chmod 600, then you can have a script on the server, that run from crontab every minute with root permission ( isolated from the web ), that access the waiting list text file, and if some user are there, it launch all the encryption commands with gpgit for every new user, and then clear the waiting list file.
Basically, you just separate the vulnerable part of the process from the standard registration process. The only downside of this scheme is that the user registration will let them wait a max amount time of 1 minute ( you can add some loader bar indicating the percentage to visually satisfy the user ).
About the line that you're telling me is not working, check the previous commands and the folder permissions:
If you did it right it should work.