smtp password stored in clear/plain text
https://github.com/nextcloud/server/blob/master/config/config.sample.php#L409
smtp password Could we get this saved as a hash instead of clear/plain text in the config file?
If I'm right we need it in plain text to authenticate against the smtp server. So how should we hash it?
Good question, I was wondering that part you bring up myself. I wonder how others do it if they even do it at all when it comes to adding one email account to another email account aka adding your hotmail to your gmail, etc. I wonder how they do it, might be scary to think of it lolol.
I'm thinking the encrypted password could just be:
user entered password plain text magic function to encrypt saved to config file as encrypted magic function to decrypt when using it with the smtp server
would have to be a reversible encryption nothing complicated just as long as the saved password in file is not human readable but can be decrypted on the fly when using it to connect to the server
could be as simple as an array of characters A = $ B = 0 C = A D = - etc... like sure people would see this in code since opensource but at least the file for someone that don't understand code could not just open or download the file and just say oh there's the password I can read it using my own two eyes and no brain.
This site I think does something like
Saves the decrypted data in a table and the hashed data in the same record when they look up the hash as an id key maybe, they just use it to reference the original decrypted data?
https://md5hashing.net/hash/
"At md5hashing.net you can hash (encrypt) any string into 66! different hash types. As you probably know - decryption of any hash is impossible, but we offer reverse decryption via our database (~1000M records, and counting)."
Maybe just as simple as storing the settings in the database instead of in a config file for the smtp info in plain text form. At least the data in a table in a db would be a layer of security than a file on the webserver.
idk I'm just brain storming stuff here my bad lololol.
Of course we could use symmetric encryption, but we would need to store the key to decrypt on the same server, so from a security point of view that's quite useless. You should configure your server so that nobody (except the admin) has access to the config.php anyway (database credentials and other sensitive information have to be stored there too). What do you think @nextcloud/security ?
As already said by @violoncelloCH it makes no sense. All info that is needed to decrypt it from any algorithm needs to be stored too, so everyone that has access to the config can always decrypt it.
Moving the info to the database does not help at all. "Security by obscurity" is the term to google here. It would only help if someone has access to your config, but that also contains the database password, so they can access the database too now.
I have rainloop installed and I looked at how they save the external email account info and it's encrypted for the password not plain text so they must be doing something to decrypt it. The info is not in a database either, it's in a text file.
Location nextcloud/data/rainloop-storage/data/default/storage/cfg/--WTV--/--WTV--/accounts
Shows your email address in plain text and your encrypted account password not in plain text I added my hotmail account to it.
I have not figured out how to decrypt it, looking over db now and rest of file system.