Add support for reading password from a different file#24
Conversation
|
Hello @dvaerum,
Yes, I'm, thanks for your PR! :-)
Because rspamd-iscan doesn't support env. variables currently but has cmdline parameters, we should add a parameter to specify a separate credentials file ( What do you think about the approach? Is there any special reason that the PR introduces to read the IMAP and rspamd credentials from different files, instead of the same? |
This does sound like a good idea, but I am a little unsure about the names of the files in the directory, but I guess that one could just use ImapPassword and RspamdPassword for file names. When if they exist they overwrite what is in the config.toml file as an example.
I am not sure if I understand what you are thinking here?
Are you thinking of using a toml-file for storing credencials?
I like the idea of implementing support for CREDENTIALS_DIRECTORY, maybe having an argument --credentials-directory that takes its default value from the environment variable CREDENTIALS_DIRECTORY, but the argument idea is mostly for having more options for configuration.
I use sops-nix in NixOS to handle my secrets, and it writes each secret to one file, so for me this is just the easiest way to handle it, without having a bash script read the files and reformat them. sops-nix does seem to support some type of template, which would solve this, but the last time I tried to use it, it did not succeed 😅 |
Reusing the fieldNames from the toml file also makes sense to me, great idea!
https://systemd.io/CREDENTIALS/ mentions that ideally applications would simply use the credentials from the environment variable
Yes, was thinking about sharing a single file for all credentials.
I see! I thought having a single file instead of multiple with credentials is easier to maintain. |
|
Okay, in summary, we want something like this?
|
|
@dvaerum Yes |
8cf3160 to
fc98f0d
Compare
|
@fho have a look 😉 |
|
@dvaerum thanks! |
|
I will take a look at making some tests. I am currently running the code on my server, so it cannot be completely broken 😉 |
fc98f0d to
ca1a4cd
Compare
|
@fho I have added some simple unittests for the patch. |
ca1a4cd to
f501bfe
Compare
f501bfe to
d1ffb4f
Compare
|
@dvaerum I'll have a look soon |
|
@dvaerum sorry, took a bit long, thanks for the PR! :-) |
|
No worries, I was already using the code so no rush from my side 😁 but don’t get me wrong I am happy to see it merged 😉 |
Hey fho, I hope you are open for pull requests 😁
I started to use rspamd-iscan, but I am handling my secret separately from my config file. So I make this little patch that allows rspamd-iscan to read the password for RspamdPasswordFile and ImapPasswordFile from a separate file.
I hope that you will accept it.