Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 880739 - net-fs/samba: Wrong privs for smbspool_krb5_wrapper
Summary: net-fs/samba: Wrong privs for smbspool_krb5_wrapper
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo's SAMBA Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-10 13:28 UTC by Joakim Tjernlund
Modified: 2022-11-25 05:36 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Tjernlund 2022-11-10 13:28:01 UTC
smbspool_krb5_wrapper is installed with -rwxr-xr-x but man page says:
   It needs to be owned by root and the
   permissions for the binary need to be 0700.

This is because cupsd will not run the wrapper as root otherwise.
Comment 1 Joakim Tjernlund 2022-11-16 10:53:58 UTC
Also, cups/backend/smp points to smb -> ../../../bin/smbspool
but in order to use Kerberos to authenticate one self this symlink
needs to point to sambas smbspool_krb5_wrapper:
  smb -> ../../samba/smbspool_krb5_wrapper
Comment 2 Joakim Tjernlund 2022-11-16 10:54:34 UTC
Suggested change:

--- samba-4.15.12.ebuild~	2022-11-16 04:10:36.000000000 +0100
+++ samba-4.15.12.ebuild	2022-11-16 11:49:43.570804454 +0100
@@ -265,6 +265,8 @@
 
 	# Make all .so files executable
 	find "${ED}" -type f -name "*.so" -exec chmod +x {} + || die
+	# smbspool_krb5_wrapper must only be accessible to root
+	find "${ED}" -type f -name "smbspool_krb5_wrapper" -exec chmod go-rwx {} + || die
 
 	if multilib_is_native_abi ; then
 		# install ldap schema for server (bug #491002)
@@ -275,8 +277,8 @@
 
 		# create symlink for cups (bug #552310)
 		if use cups ; then
-			dosym ../../../bin/smbspool \
-				/usr/libexec/cups/backend/smb
+			dosym  ../../samba/smbspool_krb5_wrapper \
+				   /usr/libexec/cups/backend/smb || die "symlink for smbspool_krb5_wrapper"
 		fi
 
 		# install example config file
Comment 3 Joakim Tjernlund 2022-11-17 09:12:13 UTC
I made a PR for the first hunk at:
https://github.com/gentoo/gentoo/pull/28307
Comment 4 Joakim Tjernlund 2022-11-23 23:57:56 UTC
Ping ?

I keep forgetting to manually change privs on smbspool_krb5_wrapper after emerging samba
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-24 00:48:30 UTC
(In reply to Joakim Tjernlund from comment #4)
> Ping ?
> 
> I keep forgetting to manually change privs on smbspool_krb5_wrapper after
> emerging samba

Could you rebase it?
Comment 6 Joakim Tjernlund 2022-11-24 07:22:00 UTC
(In reply to Sam James from comment #5)
> (In reply to Joakim Tjernlund from comment #4)
> > Ping ?
> > 
> > I keep forgetting to manually change privs on smbspool_krb5_wrapper after
> > emerging samba
> 
> Could you rebase it?

yes, done.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-24 09:03:35 UTC
thanks, on it
Comment 8 Larry the Git Cow gentoo-dev 2022-11-24 09:50:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72b1e774c4f1559b276f6441b1288b6bb0d9c3a0

commit 72b1e774c4f1559b276f6441b1288b6bb0d9c3a0
Author:     Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
AuthorDate: 2022-11-17 09:04:25 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-11-24 09:50:24 +0000

    net-fs/samba: Make smbspool_krb5_wrapper accessible to root only
    
    For CUPS to exec an plugin as root, group and others must not have privs.
    
    Closes: https://bugs.gentoo.org/880739
    Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
    Closes: https://github.com/gentoo/gentoo/pull/28307
    Signed-off-by: Sam James <sam@gentoo.org>

 net-fs/samba/{samba-4.15.12-r1.ebuild => samba-4.15.12-r2.ebuild} | 2 ++
 net-fs/samba/{samba-4.16.7-r1.ebuild => samba-4.16.7-r2.ebuild}   | 2 ++
 2 files changed, 4 insertions(+)
Comment 9 Joakim Tjernlund 2022-11-24 19:40:08 UTC
It is 100% done, there is this part too:
-			dosym ../../../bin/smbspool \
-				/usr/libexec/cups/backend/smb
+			dosym  ../../samba/smbspool_krb5_wrapper \
+				   /usr/libexec/cups/backend/smb || die "symlink for smbspool_krb5_wrapper"

which some may think is too much but if you are OK with that I can
make another PR with that change too.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-25 05:36:15 UTC
(In reply to Joakim Tjernlund from comment #9)
> It is 100% done, there is this part too:
> -			dosym ../../../bin/smbspool \
> -				/usr/libexec/cups/backend/smb
> +			dosym  ../../samba/smbspool_krb5_wrapper \
> +				   /usr/libexec/cups/backend/smb || die "symlink for
> smbspool_krb5_wrapper"
> 
> which some may think is too much but if you are OK with that I can
> make another PR with that change too.

I'm not sure if I understand the need/motivation. Can you open another bug & PR and we can discuss it there? Thanks!