/usr/sbin
NameSizeModeActions
accessdb128880755editdlrm
accton140160755editdlrm
addgnupghome30750755editdlrm
addpart254560755editdlrm
adduser1517200755editdlrm
agetty638880755editdlrm
alternatives375360755editdlrm
anacron419760755editdlrm
apachectl48040755editdlrm
applygnupgdefaults22170755editdlrm
arp662640755editdlrm
arpd1121520755editdlrm
arping294320755editdlrm
atd334080755editdlrm
atrun670755editdlrm
authconfig220570755editdlrm
avcstat167920755editdlrm
badblocks333680755editdlrm
blkdeactivate163510555editdlrm
blkdiscard297520755editdlrm
blkid1010240755editdlrm
blkmapd547520755editdlrm
blkzone509440755editdlrm
blockdev422960755editdlrm
bridge1620480755editdlrm
build-locale-archive8612480700editdlrm
capsh332240755editdlrm
cfdisk1007680755editdlrm
chcpu295200755editdlrm
chgpasswd713600755editdlrm
chkconfig461920755editdlrm
chpasswd628960755editdlrm
chroot424480755editdlrm
clock667840755editdlrm
clockdiff209200755editdlrm
consoletype121440755editdlrm
convertquota805680755editdlrm
cracklib-check133600755editdlrm
cracklib-format2510755editdlrm
cracklib-packer133680755editdlrm
cracklib-unpacker92480755editdlrm
create-cracklib-dict9900755editdlrm
crond757120755editdlrm
csf2509790700editdlrm
ctrlaltdel253840755editdlrm
ctstat259360755editdlrm
dcb1587600755editdlrm
ddns-confgen209520755editdlrm
debugfs2371840755editdlrm
delpart254560755editdlrm
depmod1637840755editdlrm
devlink2210480755editdlrm
dhclient4645680755editdlrm
dhclient-script336460755editdlrm
dmfilemapd251360555editdlrm
dmsetup1624480555editdlrm
dmstats1624480555editdlrm
dnssec-checkds9360755editdlrm
dnssec-coverage9380755editdlrm
dnssec-dsfromkey623040755editdlrm
dnssec-importkey622960755editdlrm
dnssec-keyfromlabel663120755editdlrm
dnssec-keygen745840755editdlrm
dnssec-keymgr9340755editdlrm
dnssec-revoke581040755editdlrm
dnssec-settime623040755editdlrm
dnssec-signzone1200160755editdlrm
dnssec-verify541120755editdlrm
dovecot1660720755editdlrm
dovecot_cpshutdown33440755editdlrm
dpkg-fsys-usrunmess123990755editdlrm
dump-acct298480755editdlrm
dump-utmp256160755editdlrm
dumpe2fs332960755editdlrm
e2freefrag168160755editdlrm
e2fsck3364000755editdlrm
e2image374880755editdlrm
e2label1132800755editdlrm
e2mmpstatus332960755editdlrm
e2undo208640755editdlrm
e4crypt251360755editdlrm
e4defrag291760755editdlrm
edquota934320755editdlrm
ether-wake757680755editdlrm
ethtool5711760755editdlrm
exicyclog113650755editdlrm
exigrep117100755editdlrm
exim17050964755editdlrm
eximstats1525460755editdlrm
exim_checkaccess49430755editdlrm
exim_dbmbuild246880755editdlrm
exim_dumpdb601120755editdlrm
exim_fixdb656560755editdlrm
exim_lock272240755editdlrm
exim_tidydb561200755editdlrm
exinext82170755editdlrm
exiqgrep67390755editdlrm
exiqsumm64430755editdlrm
exiwhat45240755editdlrm
exportfs843520755editdlrm
faillock210160755editdlrm
fcgistarter175200755editdlrm
fdformat339680755editdlrm
fdisk1340480755editdlrm
filefrag168560755editdlrm
findfs126720755editdlrm
fix-info-dir80330755editdlrm
fixfiles107270755editdlrm
fsck547520755editdlrm
fsck.cramfs424080755editdlrm
fsck.ext23364000755editdlrm
fsck.ext33364000755editdlrm
fsck.ext43364000755editdlrm
fsck.minix1011200755editdlrm
fsfreeze167760755editdlrm
fstrim507920755editdlrm
fuse2fs720800755editdlrm
fuser390560755editdlrm
g13-syshelp1943120755editdlrm
genhomedircon299760755editdlrm
genhostid121440755editdlrm
genl1243200755editdlrm
genrandom126720755editdlrm
getcap126480755editdlrm
getenforce80240755editdlrm
getpcaps125680755editdlrm
getsebool121520755editdlrm
groupadd976320755editdlrm
groupdel932800755editdlrm
groupmems629600755editdlrm
groupmod1017600755editdlrm
grpck629440755editdlrm
grpconv586400755editdlrm
grpunconv586320755editdlrm
grub2-bios-setup12139840755editdlrm
grub2-get-kernel-settings27420755editdlrm
grub2-install15114640755editdlrm
grub2-mkconfig88880755editdlrm
grub2-probe12139280755editdlrm
grub2-reboot40850755editdlrm
grub2-rpm-sort2899360755editdlrm
grub2-set-bootflag167444755editdlrm
grub2-set-default35350755editdlrm
grub2-set-password31190755editdlrm
grub2-setpassword31190755editdlrm
grub2-switch-to-blscfg88090755editdlrm
grubby2600755editdlrm
gss-server252000755editdlrm
gssproxy1352480755editdlrm
halt2236960755editdlrm
hardlink174960755editdlrm
htcacheclean454240755editdlrm
httpd10152560755editdlrm
hwclock667840755editdlrm
iconvconfig338400755editdlrm
ifconfig828000755editdlrm
ifdown21230755editdlrm
ifenslave255440755editdlrm
ifstat1204960755editdlrm
ifup54630755editdlrm
init16136240755editdlrm
insmod1637840755editdlrm
install-info514320755editdlrm
installkernel3230755editdlrm
ip7099440755editdlrm
ip6tables943920755editdlrm
ip6tables-legacy943920755editdlrm
ip6tables-legacy-restore943920755editdlrm
ip6tables-legacy-save943920755editdlrm
ip6tables-restore943920755editdlrm
ip6tables-save943920755editdlrm
ipmaddr215040755editdlrm
ipset92240755editdlrm
iptables943920755editdlrm
iptables-legacy943920755editdlrm
iptables-legacy-restore943920755editdlrm
iptables-legacy-save943920755editdlrm
iptables-restore943920755editdlrm
iptables-save943920755editdlrm
iptraf-ng1891040755editdlrm
iptunnel256000755editdlrm
isc-hmac-fixup121440755editdlrm
key.dns_resolver251040755editdlrm
kpartx502320755editdlrm
lchage168000755editdlrm
ldattach337840755editdlrm
ldconfig10097680755editdlrm
lfd3916290700editdlrm
lgroupadd121600755editdlrm
lgroupdel121600755editdlrm
lgroupmod203520755editdlrm
lid166640755editdlrm
lnewusers203440755editdlrm
lnstat259360755editdlrm
load_policy125760755editdlrm
logrotate952640755editdlrm
logsave168000755editdlrm
losetup927680755editdlrm
lpasswd208400755editdlrm
lsmod1637840755editdlrm
luseradd203520755editdlrm
luserdel162560755editdlrm
lusermod203600755editdlrm
lwresd8611200755editdlrm
mariadbd254524800755editdlrm
matchpathcon126640755editdlrm
mii-diag260080755editdlrm
mii-tool215360755editdlrm
mkdict2510755editdlrm
mke2fs1417680755editdlrm
mkfs168720755editdlrm
mkfs.cramfs422560755editdlrm
mkfs.ext21417680755editdlrm
mkfs.ext31417680755editdlrm
mkfs.ext41417680755editdlrm
mkfs.minix886400755editdlrm
mkhomedir_helper250240755editdlrm
mklost+found121440755editdlrm
mkswap885520755editdlrm
modinfo1637840755editdlrm
modprobe1637840755editdlrm
modsec-sdbm-util264480750editdlrm
mount.nfs2019764755editdlrm
mount.nfs42019764755editdlrm
mountstats432370755editdlrm
mysqld254524800755editdlrm
named8611200755editdlrm
named-checkconf417680755editdlrm
named-checkzone375120755editdlrm
named-compilezone375120755editdlrm
named-journalprint121360755editdlrm
nameif173840755editdlrm
newusers1098000755editdlrm
nfsconf383760755editdlrm
nfsconvert133470755editdlrm
nfsdcld674480755editdlrm
nfsdclddb102420755editdlrm
nfsdclnts92330755editdlrm
nfsdcltrack509760755editdlrm
nfsidmap464480755editdlrm
nfsiostat239220755editdlrm
nfsref673760755editdlrm
nfsstat363680755editdlrm
nft249920755editdlrm
nologin121520755editdlrm
nscd1604480755editdlrm
nsec3hash125840755editdlrm
nstat1162960755editdlrm
ntsysv419520755editdlrm
oddjobd794960755editdlrm
packer133680755editdlrm
pam_console_apply462800755editdlrm
pam_timestamp_check121524755editdlrm
paperconfig41700755editdlrm
partx967680755editdlrm
pidof170960755editdlrm
ping677120755editdlrm
ping6677120755editdlrm
pivot_root126800755editdlrm
plipconfig130160755editdlrm
pluginviewer210640755editdlrm
poweroff2236960755editdlrm
pure-authd196960755editdlrm
pure-certd196000755editdlrm
pure-config.pl47550755editdlrm
pure-ftpd1864400755editdlrm
pure-ftpwho274720755editdlrm
pure-mrtginfo114320755editdlrm
pure-quotacheck192720755editdlrm
pure-uploadscript195360755editdlrm
pwck586400755editdlrm
pwconv543760755editdlrm
pwhistory_helper209200755editdlrm
pwunconv544000755editdlrm
quot805600755editdlrm
quotacheck1185280755editdlrm
quotaoff851520755editdlrm
quotaon851520755editdlrm
quotastats169360755editdlrm
rcmysql-0editdlrm
rdisc251360755editdlrm
rdma1918800755editdlrm
readprofile210400755editdlrm
reboot2236960755editdlrm
repquota852400755editdlrm
request-key249680755editdlrm
resize2fs664720755editdlrm
resizepart425680755editdlrm
resolvconf2004480755editdlrm
restorecon210240755editdlrm
restorecon_xattr168080755editdlrm
rfkill547440755editdlrm
rmmod1637840755editdlrm
rndc374080755editdlrm
rndc-confgen209360755editdlrm
rotatelogs312400755editdlrm
route692480755editdlrm
rpc.gssd1090960755editdlrm
rpc.idmapd632160755editdlrm
rpc.mountd1669520755editdlrm
rpc.nfsd511200755editdlrm
rpc.statd1057760755editdlrm
rpcbind630240755editdlrm
rpcctl96310755editdlrm
rpcdebug198400755editdlrm
rpcinfo334240755editdlrm
rsyslogd7421200755editdlrm
rtacct480640755editdlrm
rtcwake504880755editdlrm
rtmon1200800755editdlrm
rtstat259360755editdlrm
runlevel2236960755editdlrm
runq17050964755editdlrm
runuser501680755editdlrm
sa477360755editdlrm
safe_finger128800755editdlrm
saslauthd966880755editdlrm
sasldblistusers2212640755editdlrm
saslpasswd2168160755editdlrm
sefcontext_compile669200755editdlrm
selabel_digest125760755editdlrm
selabel_lookup125680755editdlrm
selabel_lookup_best_match121760755editdlrm
selabel_partial_match121680755editdlrm
selinuxconlist121600755editdlrm
selinuxdefcon121600755editdlrm
selinuxenabled80240755editdlrm
selinuxexeccon121440755editdlrm
selinux_check_access126560755editdlrm
semanage421710755editdlrm
semodule299760755editdlrm
sendmail173202755editdlrm
service37290755editdlrm
sestatus209040755editdlrm
setcap166640755editdlrm
setenforce125600755editdlrm
setfiles210240755editdlrm
setquota935680755editdlrm
setsebool167680755editdlrm
sfdisk1213520755editdlrm
showmount215680755editdlrm
shutdown2236960755editdlrm
sim_server121520755editdlrm
slattach448080755editdlrm
sm-notify800080755editdlrm
smartctl9241200755editdlrm
smartd7419840755editdlrm
snmpd332320755editdlrm
snmptrapd333840755editdlrm
ss1958880755editdlrm
sshd8905680755editdlrm
start-statd8380755editdlrm
start-stop-daemon470880755editdlrm
suexec259044755editdlrm
sulogin504240755editdlrm
suphp68817604750editdlrm
swaplabel168960755editdlrm
swapoff212480755editdlrm
swapon505920755editdlrm
switch_root168880755editdlrm
sysctl295680755editdlrm
t1libconfig39210755editdlrm
tcpd432560755editdlrm
tcpdmatch475760755editdlrm
tcpdump10570720755editdlrm
tcpslice334160755editdlrm
tcsd3171520755editdlrm
telinit2236960755editdlrm
testsaslauthd170560755editdlrm
tipc1669840755editdlrm
tmpwatch363200755editdlrm
tracepath209280755editdlrm
tracepath6209280755editdlrm
try-from256320755editdlrm
tsig-keygen209520755editdlrm
tune2fs1132800755editdlrm
udevadm4347520755editdlrm
umount.nfs2019764755editdlrm
umount.nfs42019764755editdlrm
unbound-anchor587120755editdlrm
unix_chkpwd377444755editdlrm
unix_update377440700editdlrm
update-alternatives375360755editdlrm
update-smart-drivedb147820755editdlrm
useradd1517200755editdlrm
userdel1098640755editdlrm
userhelper459364711editdlrm
usermod1475680755editdlrm
usernetctl127044755editdlrm
uuserver162560755editdlrm
vdpa1208720755editdlrm
vigr696880755editdlrm
vipw696880755editdlrm
visudo2450240755editdlrm
weak-modules344100755editdlrm
whmapi034969120755editdlrm
whmapi134969120755editdlrm
whmlogin23900755editdlrm
wipefs421040755editdlrm
xinetd1804000755editdlrm
xqmstats168480755editdlrm
xtables-legacy-multi943920755editdlrm
zdump210560755editdlrm
zic540960755editdlrm
zramctl1015040755editdlrm
Edit: /usr/sbin/fixfiles (10727B)
#!/bin/bash # fixfiles # # Script to restore labels on a SELinux box # # Copyright (C) 2004-2013 Red Hat, Inc. # Authors: Dan Walsh # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # 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 set -o nounset # # seclabel support was added in 2.6.30. This function will return a positive # number if the current kernel version is greater than 2.6.30, a negative # number if the current is less than 2.6.30 and 0 if they are the same. # function useseclabel { VER=`uname -r` SUP=2.6.30 expr '(' "$VER" : '\([^.]*\)' ')' '-' '(' "$SUP" : '\([^.]*\)' ')' '|' \ '(' "$VER.0" : '[^.]*[.]\([^.]*\)' ')' '-' '(' "$SUP.0" : '[^.]*[.]\([^.]*\)' ')' '|' \ '(' "$VER.0.0" : '[^.]*[.][^.]*[.]\([^.]*\)' ')' '-' '(' "$SUP.0.0" : '[^.]*[.][^.]*[.]\([^.]*\)' ')' } # # Get all mount points that support labeling. Use the 'seclabel' field if it # is available. Else fall back to known fs types which likely support xattrs # and we know were not context mounted. # get_all_labeled_mounts() { FS="`cat /proc/self/mounts | sort | uniq | awk '{print $2}'`" for i in $FS; do if [ `useseclabel` -ge 0 ] then grep " $i " /proc/self/mounts | awk '{print $4}' | egrep --silent '(^|,)seclabel(,|$)' && echo $i else grep " $i " /proc/self/mounts | grep -v "context=" | egrep --silent '(ext[234]| ext4dev | gfs2 | xfs | jfs | btrfs )' && echo $i fi done } get_rw_labeled_mounts() { FS=`get_all_labeled_mounts | sort | uniq` for i in $FS; do grep " $i " /proc/self/mounts | awk '{print $4}' | egrep --silent '(^|,)rw(,|$)' && echo $i done } get_ro_labeled_mounts() { FS=`get_all_labeled_mounts | sort | uniq` for i in $FS; do grep " $i " /proc/self/mounts | awk '{print $4}' | egrep --silent '(^|,)ro(,|$)' && echo $i done } # # Get the default label returned from the kernel for a file with a lable the # kernel does not understand # get_undefined_type() { SELINUXMNT=`grep selinuxfs /proc/self/mountinfo | head -1 | awk '{ print $5 }'` cat ${SELINUXMNT}/initial_contexts/unlabeled | secon -t } # # Get the default label for a file without a label # get_unlabeled_type() { SELINUXMNT=`grep selinuxfs /proc/self/mountinfo | head -1 | awk '{ print $5 }'` cat $SELINUXMNT/initial_contexts/file | secon -t } exclude_dirs_from_relabelling() { exclude_from_relabelling= if [ -e /etc/selinux/fixfiles_exclude_dirs ] then while read i do # skip blank line and comment # skip not absolute path # skip not directory [ -z "${i}" ] && continue [[ "${i}" =~ ^[[:blank:]]*# ]] && continue [[ ! "${i}" =~ ^/.* ]] && continue [[ ! -d "${i}" ]] && continue exclude_from_relabelling="$exclude_from_relabelling -e $i" done < /etc/selinux/fixfiles_exclude_dirs fi echo "$exclude_from_relabelling" } # # Set global Variables # fullFlag=0 BOOTTIME="" VERBOSE="-p" [ -t 1 ] || VERBOSE="" FORCEFLAG="" RPMFILES="" PREFC="" RESTORE_MODE="" SETFILES=/sbin/setfiles RESTORECON=/sbin/restorecon FILESYSTEMSRW=`get_rw_labeled_mounts` FILESYSTEMSRO=`get_ro_labeled_mounts` SELINUXTYPE="targeted" if [ -e /etc/selinux/config ]; then . /etc/selinux/config FC=/etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts else FC=/etc/security/selinux/file_contexts fi # # Log all Read Only file systems # LogReadOnly() { if [ ! -z "$FILESYSTEMSRO" ]; then echo "Warning: Skipping the following R/O filesystems:" echo "$FILESYSTEMSRO" fi } # # Log directories excluded from relabelling by configuration file # LogExcluded() { for i in ${EXCLUDEDIRS//-e / }; do echo "skipping the directory $i" done } # # Find files newer then the passed in date and fix the label # newer() { DATE=$1 shift LogReadOnly for m in `echo $FILESYSTEMSRW`; do find $m -mount -newermt $DATE -print0 2>/dev/null | ${RESTORECON} ${FORCEFLAG} ${VERBOSE} $* -i -0 -f - done; } # # Compare PREVious File Context to currently installed File Context and # run restorecon on all files affected by the differences. # diff_filecontext() { EXCLUDEDIRS="`exclude_dirs_from_relabelling`" for i in /sys /proc /dev /run /mnt /var/tmp /var/lib/BackupPC /home /tmp /dev; do [ -e $i ] && EXCLUDEDIRS="${EXCLUDEDIRS} -e $i"; done LogExcluded if [ -f ${PREFC} -a -x /usr/bin/diff ]; then TEMPFILE=`mktemp ${FC}.XXXXXXXXXX` test -z "$TEMPFILE" && exit PREFCTEMPFILE=`mktemp ${PREFC}.XXXXXXXXXX` sed -r -e 's,:s0, ,g' $PREFC | sort -u > ${PREFCTEMPFILE} sed -r -e 's,:s0, ,g' $FC | sort -u | \ /usr/bin/diff -b ${PREFCTEMPFILE} - | \ grep '^[<>]'|cut -c3-| grep ^/ | \ egrep -v '(^/home|^/root|^/tmp|^/dev)' |\ sed -r -e 's,[[:blank:]].*,,g' \ -e 's|\(([/[:alnum:]]+)\)\?|{\1,}|g' \ -e 's|([/[:alnum:]])\?|{\1,}|g' \ -e 's|\?.*|*|g' \ -e 's|\{.*|*|g' \ -e 's|\(.*|*|g' \ -e 's|\[.*|*|g' \ -e 's|\.\*.*|*|g' \ -e 's|\.\+.*|*|g' | \ # These two sorts need to be separate commands \ sort -u | \ sort -d | \ while read pattern ; \ do if ! echo "$pattern" | grep -q -f ${TEMPFILE} 2>/dev/null; then \ echo "$pattern"; \ case "$pattern" in *"*") \ echo "$pattern" | sed -e 's,^,^,' -e 's,\*$,,g' >> ${TEMPFILE};; esac; \ fi; \ done | \ ${RESTORECON} ${VERBOSE} ${EXCLUDEDIRS} ${FORCEFLAG} $* -i -R -f -; \ rm -f ${TEMPFILE} ${PREFCTEMPFILE} fi } rpmlist() { rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" | grep '^0 ' | cut -f2- -d ' ' [ ${PIPESTATUS[0]} != 0 ] && echo "$1 not found" >/dev/stderr } # # restore # if called with -n will only check file context # restore () { OPTION=$1 shift # [-B | -N time ] if [ -n "$BOOTTIME" ]; then newer $BOOTTIME $* return fi # -C PREVIOUS_FILECONTEXT if [ "$RESTORE_MODE" == PREFC ]; then diff_filecontext $* return fi [ -x /usr/sbin/genhomedircon ] && /usr/sbin/genhomedircon EXCLUDEDIRS="`exclude_dirs_from_relabelling`" LogExcluded case "$RESTORE_MODE" in RPMFILES) for i in `echo "$RPMFILES" | sed 's/,/ /g'`; do rpmlist $i | ${RESTORECON} ${VERBOSE} ${EXCLUDEDIRS} ${FORCEFLAG} $* -i -R -f - done ;; FILEPATH) ${RESTORECON} ${VERBOSE} ${EXCLUDEDIRS} ${FORCEFLAG} $* -R -- "$FILEPATH" ;; *) if [ -n "${FILESYSTEMSRW}" ]; then LogReadOnly echo "${OPTION}ing `echo ${FILESYSTEMSRW}`" ${SETFILES} ${VERBOSE} ${EXCLUDEDIRS} ${FORCEFLAG} $* -q ${FC} ${FILESYSTEMSRW} else echo >&2 "fixfiles: No suitable file systems found" fi if [ ${OPTION} != "Relabel" ]; then return fi echo "Cleaning up labels on /tmp" rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-* UNDEFINED=`get_undefined_type` || exit $? UNLABELED=`get_unlabeled_type` || exit $? find /tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) \( -type s -o -type p \) -delete find /tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /tmp {} \; find /var/tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /var/tmp {} \; find /var/run \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /var/run {} \; [ ! -e /var/lib/debug ] || find /var/lib/debug \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /lib {} \; ;; esac } fullrelabel() { echo "Cleaning out /tmp" find /tmp/ -mindepth 1 -delete restore Relabel } relabel() { if [ -n "$RESTORE_MODE" -a "$RESTORE_MODE" != DEFAULT ]; then usage exit 1 fi if [ $fullFlag == 1 ]; then fullrelabel return fi 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 fullrelabel else restore Relabel fi } process() { # # Make sure they specified one of the three valid commands # case "$1" in restore) restore Relabel;; check) VERBOSE="-v"; restore Check -n;; verify) VERBOSE="-v"; restore Verify -n;; relabel) relabel;; onboot) if [ -n "$RESTORE_MODE" -a "$RESTORE_MODE" != DEFAULT ]; then usage exit 1 fi > /.autorelabel || exit $? [ -z "$FORCEFLAG" ] || echo -n "$FORCEFLAG " >> /.autorelabel [ -z "$BOOTTIME" ] || echo -N $BOOTTIME >> /.autorelabel # Force full relabel if SELinux is not enabled selinuxenabled || echo -F > /.autorelabel echo "System will relabel on next boot" ;; *) usage exit 1 esac } usage() { echo $""" Usage: $0 [-v] [-F] [-f] relabel or Usage: $0 [-v] [-F] [-B | -N time ] { check | restore | verify } or Usage: $0 [-v] [-F] { check | restore | verify } dir/file ... or Usage: $0 [-v] [-F] -R rpmpackage[,rpmpackage...] { check | restore | verify } or Usage: $0 [-v] [-F] -C PREVIOUS_FILECONTEXT { check | restore | verify } or Usage: $0 [-F] [-B] onboot """ } if [ $# -eq 0 ]; then usage exit 1 fi set_restore_mode() { if [ -n "$RESTORE_MODE" ]; then # can't specify two different modes usage exit 1 fi RESTORE_MODE="$1" } # See how we were called. while getopts "N:BC:FfR:l:v" i; do case "$i" in B) BOOTTIME=`/bin/who -b | awk '{print $3}'` set_restore_mode DEFAULT ;; N) BOOTTIME=$OPTARG set_restore_mode BOOTTIME ;; R) RPMFILES=$OPTARG set_restore_mode RPMFILES ;; C) PREFC=$OPTARG set_restore_mode PREFC ;; v) VERBOSE="-v" ;; l) # Old scripts use obsolete option `-l logfile` echo "Redirecting output to $OPTARG" exec >>"$OPTARG" 2>&1 ;; F) FORCEFLAG="-F" ;; f) fullFlag=1 ;; *) usage exit 1 esac done # Move out processed options from arguments shift $(( OPTIND - 1 )) # Check for the command if [ $# -eq 0 ]; then usage exit 1 fi command="$1" # Move out command from arguments shift if [ $# -gt 0 ]; then set_restore_mode FILEPATH while [ $# -gt 0 ]; do FILEPATH="$1" process "$command" || exit $? shift done else process "$command" fi