Skip to contentSkip to conversation

init, checkpolicy manpage and labeling questions

DISCUSSION Magosányi Árpád 2 participants 2 messages Aug 28, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi!

First the questions:

Make relabel complained about /var/run/pump.sock . putting a <<none>> in file_contexts did not help, but I could manage it by removing the socket.
Do we have labels on sockets yet?

My other problem is with various files in /dev. I use devfs and devfsd. for example getfilecon fails for /dev/console, /dev/null, and /dev/pts/0 (in a devpts fs). Can someone explain the situation to me?

You can find a checkpolicy manpage attached. I was not too definiitive:) Also here is my boot method, as I did not want to bootfrom initrd:
the real init is moved to /sbin/real_init, and have the same context as the real init: system_u:object_r:init_exec_t
/sbin/init have root:object_r:sbin_t ( I think it isn't count anyway). The source for /sbin/init:
-------------
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>

int main(int argc, char **argv)

{
        system("/etc/init.d/preinit.sh");
        execv("/sbin/real_init", argv);
        return errno;
}

------------------
/etc/init.d/preinit.sh:
------------------
#/bin/bash
mount /selinux
mount /proc
/usr/sbin/load_policy /etc/security/selinux/policy.15
-----------------

Signature · 1 line
GNU GPL: csak tiszta forrásból

.TH CHECKPOLICY 8
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other parms are allowed: see man(7), man(1)
.SH NAME
checkpolicy \- SELinux policy compiler
.SH SYNOPSIS
.B checkpolicy
.I "checkpolicy [-b] [-d] [-o output_file] [input_file]"
.br
.SH "DESCRIPTION"
This manual page documents briefly the
.BR checkpolicy ,
command.
This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page. .PP
.B checkpolicy
is a program that checks and compiles a SELinux security policy file to binary representation.

It is used by the Makefile which compiles and installs the security policy.

.SH OPTIONS
.TP
.B \-h, \-\-help
Show summary of options, because do not understands this option. .TP
.B \-b
Maybe this is to generate binary output.
.TP
.B \-d
Maybe this is to generate debug information.
.TP
.B \-o filename
The output file name.
.SH "SEE ALSO"
SELinux documentation http://www.nsa.gov/selinux/docs.html,
especially "Configuring the SELinux Policy".

The example policy configuration must be compiled into a binary representation before it can be read by the example security server. The compilation is performed by running make in the policy directory. The compilation involves three steps. First, the example policy configuration files are concatenated togther. Second, the m4 macro processor is applied to the resulting concatenation to expand macros, yielding the policy.conf file. The checkpolicy policy compiler is then run on this file to generate the binary representation in the policy.VERSION file, where VERSION represents the version number.

The policy.VERSION file can be installed into the /etc/security/selinux directory by running make install. The policy will then be loaded by the example security server when the kernel is next rebooted. If a runtime policy change is desired (and authorized by the policy configuration), then the make load command can be run to load the policy into a running kernel. In the example policy configuration, dynamically reloading the policy can only be done by the sysadm_t domain. .SH AUTHOR
This manual page was written by Árpád Magosányi <[email protected]>,
for the Debian GNU/Linux system (but may be used by others).

#1 lore raw
Quoted 6 lines · Magosányi Árpád

First the questions:

Make relabel complained about /var/run/pump.sock . putting a <<none>> in file_contexts did not help, but I could manage it by removing the socket.
Do we have labels on sockets yet?

Yes, this should work. Are you using ext2 or ext3? If ext2, then you need the patch I posted on Monday in response to Karl MacMillan's posting on the list; there is a typo in an #ifdef in ext2/namei.c that prevents special inodes from getting the xattr operations.

Quoted 3 lines

My other problem is with various files in /dev. I use devfs and devfsd. for example getfilecon fails for /dev/console, /dev/null, and /dev/pts/0 (in a devpts fs). Can someone explain the situation to me?

For devpts, you need to enable the xattr handler, as mentioned in the selinux-doc README. There is presently no xattr handler for devfs; you can implement one if you like, but devfs appears to be obsolete.

Quoted 1 line

You can find a checkpolicy manpage attached. I was not too definiitive:)

Thanks, I'll take a look at it, since I wrote the program.

Quoted 1 line

Also here is my boot method, as I did not want to boot from initrd:

Any particular reason?

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.