Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#57787 - [ssmtp] world-readable config file with email credentials
Attached to Project:
Community Packages
Opened by bobpaul (bobpaul) - Sunday, 11 March 2018, 02:26 GMT
Last edited by David Runge (dvzrv) - Friday, 16 March 2018, 22:02 GMT
Opened by bobpaul (bobpaul) - Sunday, 11 March 2018, 02:26 GMT
Last edited by David Runge (dvzrv) - Friday, 16 March 2018, 22:02 GMT
|
DetailsDescription:
Upstream has a bug (#661954) from 2012 to secure the /etc/ssmtp/ssmtp.conf file. The arch wiki instructs users to add their own ssmtp group to own the binary and conf file and to place a hook script in libalpm. Ubuntu has fixed it using the system's existing mail group. Attached is an updated PKGBUILD and a new .install script to implement the solution Ubuntu chose, rather than creating a package specific group. This is a minimal change from upstream, where the package appears to be abandoned, and I don't think users should need to read the wiki to secure official packages. |
This task depends upon
Closed by David Runge (dvzrv)
Friday, 16 March 2018, 22:02 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in 2.64-12
Friday, 16 March 2018, 22:02 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in 2.64-12
ssmtp-2.64-10.src.tar.gz
I couldn't figure out a way to change the group without the install script.
Also setgid in package() while it is still using the root group is a race condition that adds its own security issues... what happens if the install script is interrupted, or if someone uses that binary after the files are extracted but before the install script runs.
FS#57693I'll get to updating this package shortly!
I've applied fixes to the package. If anything doesn't work as expected, reopen this task or open a new one.
And Eli pointed out I needed more quotes. Change the last lines of package() to:
----
chgrp mail "${pkgdir}/etc/ssmtp/ssmtp.conf" "${pkgdir}/usr/bin/ssmtp"
chmod 640 "${pkgdir}/etc/ssmtp/ssmtp.conf"
chmod 2755 "${pkgdir}/usr/bin/ssmtp"
How about /etc/ssmtp/revaliases though? I think it should also be 640, or is this file changed by using newaliases in some way?
I have to update the .install file as well.
It looks like Ubuntu protects the whole directory. (On older versions they only protected ssmtp.conf). Here's after freshly installing on Ubuntu 16.04.04:
/etc/ssmtp# ls -lah
total 24K
drwxr-x--- 2 root mail 4.0K Mar 12 12:53 .
drwxr-xr-x 126 root root 12K Mar 12 12:53 ..
-rw-r----- 1 root mail 200 Apr 13 2016 revaliases
-rw-r----- 1 root mail 597 Mar 12 12:53 ssmtp.conf
BTW, /usr/bin/{sendmail,newaliases,mailq} are all symlinks to ssmtp, so their permission don't matter. But setting them like you are doesn't hurt anything.