2004-09-09 10:34:56 +00:00
|
|
|
--- policycoreutils-1.13/scripts/fixfiles.rhat 2004-05-21 14:26:51.000000000 -0400
|
2004-09-09 10:34:58 +00:00
|
|
|
+++ policycoreutils-1.13/scripts/fixfiles 2004-05-25 15:06:03.586866792 -0400
|
|
|
|
@@ -19,24 +19,42 @@
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
-
|
|
|
|
-FC=/etc/security/selinux/file_contexts
|
|
|
|
+SELINUXTYPE="targeted"
|
2004-09-09 10:35:00 +00:00
|
|
|
+. /etc/selinux/config
|
|
|
|
+FC=/etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts
|
2004-09-09 10:34:56 +00:00
|
|
|
LOGFILE=`mktemp /var/tmp/fixfiles.XXXXXXXXXX` || exit 1
|
|
|
|
-echo "logging to $LOGFILE"
|
2004-09-09 10:34:37 +00:00
|
|
|
SETFILES=/usr/sbin/setfiles
|
2004-09-09 10:34:56 +00:00
|
|
|
FILESYSTEMS=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs).*rw/{print $3}';`
|
2004-09-09 10:34:37 +00:00
|
|
|
checkLabels () {
|
2004-09-09 10:34:56 +00:00
|
|
|
+echo "logging to $LOGFILE"
|
|
|
|
${SETFILES} -v -n ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
|
2004-09-09 10:34:14 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 10:34:37 +00:00
|
|
|
restoreLabels () {
|
2004-09-09 10:34:56 +00:00
|
|
|
+echo "logging to $LOGFILE"
|
|
|
|
${SETFILES} -v ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
|
2004-09-09 10:34:14 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 10:34:37 +00:00
|
|
|
relabel() {
|
2004-09-09 10:34:56 +00:00
|
|
|
+echo "logging to $LOGFILE"
|
2004-09-09 10:34:37 +00:00
|
|
|
echo "Cleaning out /tmp"
|
|
|
|
rm -rf /tmp/.??* /tmp/*
|
2004-09-09 10:34:56 +00:00
|
|
|
-${SETFILES} ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
|
|
|
|
+${SETFILES} -v ${FC} ${FILESYSTEMS} 2>&1 | tee $LOGFILE
|
|
|
|
+}
|
|
|
|
+relabelCheck() {
|
|
|
|
+echo -n "
|
|
|
|
+Files in the /tmp directory may be labeled incorrectly, this command
|
|
|
|
+can remove all files in /tmp. If you choose to remove files from /tmp,
|
|
|
|
+a reboot will be required after completion.
|
|
|
|
+
|
|
|
|
+Do you wish to clean out the /tmp directory [N]? "
|
|
|
|
+read answer
|
|
|
|
+if [ "$answer" = y -o "$answer" = Y ]; then
|
|
|
|
+ relabel
|
|
|
|
+else
|
|
|
|
+ restoreLabels
|
|
|
|
+fi
|
|
|
|
+
|
2004-09-09 10:34:37 +00:00
|
|
|
}
|
2004-09-09 10:34:14 +00:00
|
|
|
|
2004-09-09 10:34:37 +00:00
|
|
|
# See how we were called.
|
2004-09-09 10:34:58 +00:00
|
|
|
@@ -48,10 +66,15 @@
|
2004-09-09 10:34:56 +00:00
|
|
|
restoreLabels
|
|
|
|
;;
|
|
|
|
relabel)
|
|
|
|
- relabel
|
|
|
|
+ relabelCheck
|
|
|
|
;;
|
|
|
|
+ -F)
|
|
|
|
+ if "$1" = "relabel"; then
|
|
|
|
+ relabel
|
|
|
|
+ fi
|
|
|
|
+ ;;
|
|
|
|
*)
|
|
|
|
- echo $"Usage: $0 {check|restore|relabel}"
|
|
|
|
+ echo $"Usage: $0 {check|restore|[-F] relabel}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
exit $?
|