Bug 145359 - inconsistent chcon failure: can't apply partial context to unlabeled file
Summary: inconsistent chcon failure: can't apply partial context to unlabeled file
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-01-17 19:04 UTC by Tom Lane
Modified: 2013-07-03 03:03 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-01-18 11:34:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tom Lane 2005-01-17 19:04:49 UTC
Description of problem:
I'm currently testing a new init script for postgresql that does
this to create a log file that's not known to selinux-policy-targeted:

PGLOG=/var/lib/pgsql/pgstartup.log
touch "$PGLOG" || exit 1
chown postgres:postgres "$PGLOG"
chmod go-rwx "$PGLOG"
[ -x /usr/bin/chcon ] && /usr/bin/chcon -t postgresql_log_t "$PGLOG"

This works fine for me, but I have a report that someone else running
the same coreutils release gets

/usr/bin/chcon: can't apply partial context to unlabeled file
/var/lib/pgsql/pgstartup.log

Any idea why it fails for him, and what I can do about it?


Version-Release number of selected component (if applicable):
coreutils-5.2.1-31

How reproducible:
100% for him, 0% for me

Steps to Reproduce:
1.  See above, or install postgresql-8.0.0rc5-0.3 from fc4-scratch
2.
3.
  
Actual results:


Expected results:


Additional info:
See thread beginning at
http://lists.pgfoundry.org/pipermail/pgsqlrpms-hackers/2005-January/000076.html

Comment 1 Tim Waugh 2005-01-18 11:34:44 UTC
Well, like the error says, you can't have a partial label.  Your
/var/lib/pgsql/pgstartup.log file is already labelled and so it makes sense to
change part of the label.  Their file has no pre-existing label, and so what
you're trying to do doesn't make sense.

(Dan, is that right?)

Comment 2 Tom Lane 2005-01-18 13:31:27 UTC
Hm ... so how do I find out what label is on a file?  I've looked through the man pages for the selinux 
commands I know about, and found nothing :-(

Comment 3 Tim Waugh 2005-01-18 13:37:01 UTC
ls -Z

Comment 4 Daniel Walsh 2005-01-18 22:42:06 UTC
This says the file has no label to start, so you can specify just a partial
context.  So I believe the user is running on a unlabeled system.
IE 

ls -Z shows no label.

so chcon -t XYZ fails because there is no User or Role section.



Note You need to log in before you can comment on or make changes to this bug.