Bug 496222

Summary: (selinux, ntpd) selinux in enforcing mode do not allow ntpd to read /ntp.conf
Product: [Fedora] Fedora Reporter: Pierre Blavy <pierreblavy>
Component: dhcpAssignee: David Cantrell <dcantrell>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: dcantrell, dwalsh, jkubin, mgrepl, wwoods
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-17 14:16:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pierre Blavy 2009-04-17 12:05:38 UTC
Description of problem:
Selinux prevents ntpd to read ./ntp.conf ("dhcpc_state_t")


Version-Release number of selected component (if applicable): 
My last yum update was done the 17 april 09, so it's the last version. 


How reproducible: Always

Steps to Reproduce:
1. use selinux with  SELINUX=enforcing and SELINUXTYPE=targeted  in your /etc/sysconfig/selinux
2. restart the ntpd service (service ntpd stop; service ntpd start)
  
Actual results:


Expected results:
Please update the selinux policy to allow ntpd to read its own config file.


Additional info: 
1)Selinux security report
2)/etc/sysconfig/selinux

--------------------
1)
--------------------

RésuméSELinux empêche ntpd (ntpd_t) "read" à ./ntp.conf ("dhcpc_state_t"). Description détailléeSELinux a refusé l'accès demandé par ntpd. Il n'est pas prévu que cet accès soit requis par ntpd et cet accès peut signaler une tentative d'intrusion. Il est également possible que cette version ou cette configuration spécifique de l'application provoque cette demande d'accès supplémentaire. Autoriser l'accèsDes problèmes d'étiquetages peuvent causer des refus de la part de SELinux. Vous pourriez essayer de revenir au contexte par défaut du système de fichier pour ./ntp.conf, restorecon -v ./ntp.conf Si cela ne fonctionne pas, il n'y a actuellement aucune manière automatique d'autoriser cet accès. Par contre, vous pouvez créer un module de stratégie locale pour autoriser cet accès - lisez la FAQ Vous pouvez également désactiver la protection fournie par SELinux. Désactiver SELinux n'est pas recommandé. Merci de remplir un rapport de bogue sur ce paquet. Informations complémentairesContexte source:  unconfined_u:system_r:ntpd_t:s0Contexte cible:  system_u:object_r:dhcpc_state_t:s0Objets du contexte:  ./ntp.conf [ file ]source:  ntpdChemin de la source:  /usr/sbin/ntpdPort:  <Inconnu>Hôte:  pcpblavyPaquetages RPM source:  ntp-4.2.4p6-1.fc10Paquetages RPM cible:  Politique RPM:  selinux-policy-3.5.13-55.fc10Selinux activé:  TrueType de politique:  targetedMLS activé:  TrueMode strict:  EnforcingNom du plugin:  catchall_fileNom de l'hôte:  pcpblavyPlateforme:  Linux pcpblavy 2.6.27.21-170.2.56.fc10.x86_64 #1 SMP Mon Mar 23 23:08:10 EDT 2009 x86_64 x86_64Compteur d'alertes:  1Première alerte:  ven. 17 avril 2009 13:00:52 CESTDernière alerte:  ven. 17 avril 2009 13:00:52 CESTID local:  025b95b6-bc7a-482b-90cf-93ceee54b56aNuméros des lignes:  Messages d'audit bruts :node=pcpblavy type=AVC msg=audit(1239966052.417:18): avc: denied { read } for pid=4178 comm="ntpd" name="ntp.conf" dev=sda5 ino=1188521 scontext=unconfined_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:dhcpc_state_t:s0 tclass=file node=pcpblavy type=SYSCALL msg=audit(1239966052.417:18): arch=c000003e syscall=2 success=no exit=-13 a0=7fbb4bd41c12 a1=0 a2=1b6 a3=7fbb4bcaf6f0 items=0 ppid=4176 pid=4178 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm="ntpd" exe="/usr/sbin/ntpd" subj=unconfined_u:system_r:ntpd_t:s0 key=(null) 




-----------------------
2)
-----------------------
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#	enforcing - SELinux security policy is enforced.
#	permissive - SELinux prints warnings instead of enforcing.
#	disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#	targeted - Targeted processes are protected,
#	mls - Multi Level Security protection.
SELINUXTYPE=targeted

Comment 1 Daniel Walsh 2009-04-17 12:43:32 UTC
This problem is caused by a bug in the dhclient scripts that created the ntp.conf file.  They need to run restorecon on the file after they create it, which I believe they do in the latest release.

You can fix your labeling by executing

restorecon -R -v /etc

Comment 2 Pierre Blavy 2009-04-17 14:15:20 UTC
restorecon -R -v /etc  

This script works where you are root.
Thanks!