tarickb / sasl-xoauth2

SASL plugin for XOAUTH2
Other
72 stars 20 forks source link

Should the package ship a world-readable config file? #56

Open dkg opened 1 year ago

dkg commented 1 year ago

The config file in /etc/sasl-xoauth2.conf is by default world-readable, but it contains (as a template):

{
  "client_id": "CLIENT_ID_GOES_HERE",
  "client_secret": "CLIENT_SECRET_GOES_HERE"
}

As a packager, it makes me a little bit worried that we're shipping something world-readable that says it contains a "secret". This is a configuration file that i'll want the package to maintain as the versions advance, but there are various problems with ensuring that the file is readable by the right parties (presumably postfix needs to read it, but binding it tightly to postfix makes it that much harder to use with some other toolchain in the future, if that ever happens), as well as problems with upgrading the shipped configuration file when the admin has manually modified it (this always makes package upgrades a chore).

A couple possible approaches to resolve this:

If we go with the first option (which is my preference), i'd the documentation could be either a sasl-xoauth2.conf(5) manual page or an example config file (with some comments) someplace like /usr/share/doc/sasl-xoauth2/examples/sasl-xoauth2.conf. In either case, we'd want the documentation to clearly state:

any preferences for how to solve this?

tarickb commented 1 year ago

I'm not entirely convinced it's a real problem to have the client secret stored in a world-readable file (see #57), but if we have to do something about this, I'd also prefer the first option. It's not like the file we're shipping now is in any way useful -- it has to be modified anyway.

Unfortunately the config file is treated as JSON data so we don't really have a great way to annotate parameters and usage. I think (?) the best we can do is the template format we have today. Does this mean we'll have to go the sasl-xoauth2.conf(5) manual page route?

dkg commented 1 year ago

I'll go ahead and avoid shipping the config file directly in /etc/sasl-xoauth2.conf, and i'll ship a copy in /usr/share/doc/sasl-xoauth2/ - if you could create a sasl-xoauth2.conf(5) manpage, that would be great! I've offered #59 as one possible starting point, but i defer to you on the best way to generate/integrate this kind of thing.

dkg commented 1 year ago

btw, @rrthomas (a debian user) wrote to me:

I don't think I have particular insights here. I don't use /etc/sasl-xoauth2.conf, as postfix files have to go in a different location for postfix's /var/spool/postfix chroot (but yes, it should not be world-readable by default), and I simply don't use the command-line argument (but I agree it should probably be removed so as not to offer users a way to shoot themselves in the foot). I can't think of any reason why changing these would be particularly bad (removing the command-line option might annoy some users, but clearly in their own interests!).

dkg commented 1 year ago

I'll go ahead and avoid shipping the config file directly in /etc/sasl-xoauth2.conf, and i'll ship a copy in /usr/share/doc/sasl-xoauth2/

This is done with 0.19-2, in debian experimental now.

tarickb commented 9 months ago

I'm sorry this slipped off my radar for a while. @dkg -- anything left for us to do here?