From: antoine <antoine@nagafix.co.uk>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: SELinux <selinux@tycho.nsa.gov>
Subject: Re: general selinux questions
Date: Fri, 10 Jun 2005 15:21:36 +0100 [thread overview]
Message-ID: <1118413296.10190.312.camel@localhost> (raw)
In-Reply-To: <1118342206.30110.132.camel@moss-spartans.epoch.ncsc.mil>
On Thu, 2005-06-09 at 14:36 -0400, Stephen Smalley wrote:
> On Thu, 2005-06-09 at 13:25 +0100, antoine wrote:
> > Some more questions:
> > 7) What can I do to logrotate.te to make it rotate my mysql logfiles but
> > have the correct label on the new /var/log/mysql/mysql.log file. As it
> > is now it comes up as var_log_t rather than mysql_var_log_t
>
> Does type mysqle_var_log_t have the logfile attribute?
It is created using 'log_domain(mysqld)':
#grep mysqld_log_t policy.conf
type mysqld_log_t, file_type, sysadmfile, logfile;
allow mysqld_t mysqld_log_t:file { create ioctl read getattr lock write
setattr append link unlink rename };
type_transition mysqld_t var_log_t:file mysqld_log_t;
allow initrc_t mysqld_log_t:file { write append setattr ioctl };
So I'm not sure why it does not behave, here is the syslog-ng.d/mysql:
/var/log/mysql/mysql.err /var/log/mysql/mysql.log /var/log/mysql/mysqld.err {
monthly
create 660 mysql mysql
notifempty
size 5M
sharedscripts
missingok
postrotate
/bin/kill -HUP `cat /var/run/mysqld/mysqld.pid`
endscript
}
> If so, then
> logrotate.te should be allowing logrotate the necessary permissions to
> re-create the file with that type. Of course, your logrotate program
> has to be modified to preserve types on log files; the one in Fedora
> should have such modifications.
I am using this one from Gentoo 2004.1 (which has selinux support):
syslog-ng-1.6.7 -hardened +selinux -static +tcpd
(latest from amd64 stable) Which is supposed to have the same mods.
logrotate.te contains:
# Set a context other than the default one for newly created files.
can_setfscreate(logrotate_t)
# Change ownership on log files.
allow logrotate_t self:capability { chown dac_override dac_read_search
kill fsetid fowner sys_resource sys_nice };
So I guess that my next question is: how do I figure out what is going
wrong?
> > 8) How can I allow daemons to write to /dev/log?
> > allow psad_t devlog_t:sock_file write;
> > Is not allowed...
>
> Add the 'privlog' attribute to the domain for the daemon.
Ah Thanks.
> > 9) One of my scripts needs to kill a few processes by name (if they
> > exist) so it does something like 'ps -ef | grep "someLongUniqueString in
> > processName"' but that triggers all sorts of violations. Is there a
> > better way?
>
> I'm not sure why you wouldn't use killall, but I don't think that will
> help with the denials anyway.
I probably could (just that the long grep restricts more than what
killall allows - it feels safer)
> Notice that the existing policy often
> dontaudit's such attempts to avoid generating noise, e.g.
> dontaudit foo_t domain:dir search;
> Note that if you are in enforcing mode, then it will stop trying after
> the search failure, so you won't get the subsequent denials on the
> attempts to read files under the directory. So don't assume that you
> need to add more dontaudit rules just because of the output while in
> permissive mode.
Good, I hadn't thought of that.
Many thanks
Antoine
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2005-06-10 14:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-09 1:50 general selinux questions antoine
2005-06-09 12:25 ` antoine
2005-06-09 18:36 ` Stephen Smalley
2005-06-10 14:21 ` antoine [this message]
2005-06-10 14:18 ` Stephen Smalley
2005-06-10 14:55 ` antoine
2005-06-10 14:50 ` Stephen Smalley
2005-06-10 8:11 ` Jayendren Anand Maduray
2005-06-09 18:26 ` Stephen Smalley
2005-06-10 20:00 ` antoine
2005-06-10 19:54 ` Stephen Smalley
2005-06-10 19:59 ` Stephen Smalley
2005-06-14 17:24 ` antoine
2005-06-14 17:37 ` Colin Walters
2005-06-14 19:50 ` antoine
2005-06-22 19:54 ` antoine
2005-06-23 15:33 ` antoine
2005-06-23 17:04 ` Stephen Smalley
2005-06-23 17:41 ` antoine
2005-06-23 17:44 ` Stephen Smalley
2005-06-23 17:55 ` Stephen Smalley
2005-06-23 22:50 ` antoine
2005-06-24 12:13 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1118413296.10190.312.camel@localhost \
--to=antoine@nagafix.co.uk \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.