Re: Issues with the include/contrib/courier.if policy

Sam Varshavchik <[email protected]>
Newsgroups gmane.linux.redhat.fedora.selinux
Message-ID <[email protected]>
Lukas Vrabec writes:

> Hi Sam,
>
> It looks like there is missing file context definition for files in
> /usr/lib/courier/libexec/
>
> Can you please try to label whole directory as "courier_exec_t" ?
>
> # semanage fcontext -a -t courier_exec_t /usr/lib/courier/libexec(/.*)?
> # restorecon -Rv /usr/lib/courier
>
> Can you then reproduce your scenario?

I tried this after also updating to F32. The resulting relabeling:

Relabeled /usr/lib/courier/libexec from system_u:object_r:bin_t:s0 to  
system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier from system_u:object_r:bin_t:s0  
to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/sqwebpasswd from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/courierd from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/aliascreate from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/sqwebmaild from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/submit from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/aliascombine from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/submitmkdir from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/imaplogin from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/makedatprog from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/fax from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/fax/courierfax from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/esmtp from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/esmtp/courieresmtp from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/esmtp/addcr from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/esmtp/courieresmtpd from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/uucp from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/uucp/courieruucp from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/dsn from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/dsn/courierdsn from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/local from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/local/courierdeliver from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/modules/local/courierlocal from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/aliasexp from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/courierfilter from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/courier/pcpd from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/filters from system_u:object_r:bin_t:s0  
to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/filters/perlfilter from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/filters/ratefilter from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/filters/verifyfilter from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0
Relabeled /usr/lib/courier/libexec/filters/dupfilter from  
system_u:object_r:bin_t:s0 to system_u:object_r:courier_exec_t:s0

After a server restart, the result was a slightly different AVC:

Additional Information:
Source Context                system_u:system_r:httpd_sys_script_t:s0
Target Context                system_u:object_r:courier_spool_t:s0
Target Objects                /var/spool/courier [ dir ]
Source                        webmail
Source Path                   webmail
Port                          <Unknown>
Host                          jack
Source RPM Packages
Target RPM Packages           courier-1.0.13.20200509-101.fc32.x86_64
SELinux Policy RPM            selinux-policy-targeted-3.14.5-38.fc32.noarch
Local Policy RPM              selinux-policy-targeted-3.14.5-38.fc32.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     jack
Platform                      Linux jack 5.6.11-300.fc32.x86_64 #1 SMP Wed  
May 6
                              19:12:19 UTC 2020 x86_64 x86_64
Alert Count                   8
First Seen                    2020-05-16 21:43:39 EDT
Last Seen                     2020-05-16 22:07:47 EDT
Local ID                      ac01b623-e181-48dc-a097-fea6c8dd27b3

Raw Audit Messages
type=AVC msg=audit(1589681267.341:2551): avc:  denied  { search } for   
pid=322657 comm="webmail" name="courier" dev="md125" ino=5901229  
scontext=system_u:system_r:httpd_sys_script_t:s0  
tcontext=system_u:object_r:courier_spool_t:s0 tclass=dir permissive=0


It's still blocking the same connect() call:

322694 connect(3, {sa_family=AF_UNIX,  
sun_path="/var/spool/courier/sqwebmail.sock"}, 110) = -1 EACCES (Permission  
denied)

The original avc was connectto, it's now search. The directory seems to be  
labeled:

drwxr-xr-x. 12 bin bin system_u:object_r:courier_spool_t:s0 4096 May 16  
22:07 /var/spool/courier

srwxrwxrwx. 1 root root system_u:object_r:courier_spool_t:s0 0 May 16 22:13  
/var/spool/courier/sqwebmail.sock

The other issue – with the SIGINT/SIGKILL from rpm scriptlets getting  
blocked – still exists too; however I'll work on changing the scriptlets to  
use systemctl to restart everything. This is less ideal than just stopping  
the individual service, but it should work.

The good news is that the relabeling does not appear to have any ill  
effects. /usr/lib/courier/libexec holds all core executables, so I wanted to  
spot-check; I spot checked a few, they seemed to work, but I haven't checked  
all of them.

Just to remain in sync on this, I restore the default configuration:

semanage fcontext -d '/usr/lib/courier/libexec(/.*)?'
restorecon -Rv /usr/lib/courier

Thanks,

_______________________________________________
selinux mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/[email protected]
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEMWrVnbBKLOeG9ifkazpiviedvyUFAl7AoI0ACgkQazpivied
vyW3pg/+I5ZDzADfgjYXpC9bHAkB82HgUB0aqJji2MH9B4t0t1M4w63vy1066S/K
COjDfs1iYE023OWe7RkmNVhd6iYiy3Ip3OJY2I+vtqwQfm4VCKtLm4vlsUu6de+c
pWqHh+ywTRYASuXtcXRUns5MdnWrvlenYGgCnF3gh0nBYvkC/LO+Wq3NRKLXJ2dG
0Fl0NwMFJNNBL9/BhNwYXIIJp7iM0Xkct4DRmZ0S+xRzknFRC/Ri8Os38NtjfCDp
mfiSIiXojysu/1R/VXi++kBwVHXf5BaDThdvF0qvdhQMWmo5u89/DP6hqrjXvN3z
CuT4ci9QLNx9Mx/ZaFJZtIwAbcWJSD7fic797W9sThRJ+P073BOmBpw0T6R0q1T5
AXqyO2d+xGRWykMmzGg+YEW1YffRoMMFN2rfYXrdNuz2/2eEjX2+oq4MUsp0wrby
h6fCGzDiJ9KXZbkj9mJfI9Nq5WJiE9mbxh0VMzFDUnqQU12DFNrhy+VY5h3H7wOU
kMBDFtYLxeoGGJxXe2b84OgEUjNTHK3fnASDjTGyQv7S8ma24ikSJq7Uftr1G4QD
bK4ZkWIMxF8ag/fv7hYEzuks555IicArb4UBYCSbJfQfdEssXot12tnahEf1JMbv
xuFm9qS3ncsaRuBHeLrnX4ZdO/77Am/Xc2qe978/RK7tj4q325c=
=4gib
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.