Как мне создать новый контекст SELinux и добавить его в файл / каталог?

541
Chloe

У меня есть следующее

audit.log
type=AVC msg=audit(1484787464.870:381223): avc: denied { execute } for pid=10683 comm="pipe" name="tmp.pl" dev=xvde ino=30503 scontext=unconfined_u:system_r:postfix_pipe_t:s0 tcontext=unconfined_u:object_r:usr_t:s0 tclass=file type=SYSCALL msg=audit(1484787464.870:381223): arch=c000003e syscall=59 success=no exit=-13 a0=7f12efd23ca0 a1=7f12efd23c60 a2=7f12efd23de0 a3=7ffd0f0802f0 items=0 ppid=10681 pid=10683 auid=0 uid=497 gid=12 euid=497 suid=497 fsuid=497 egid=12 sgid=12 fsgid=12 tty=(none) ses=4439 comm="pipe" exe="/usr/libexec/postfix/pipe" subj=unconfined_u:system_r:postfix_pipe_t:s0 key=(null) 
maillog
Jan 19 00:57:45 ip-99-99-99-99 pipe[10685]: fatal: pipe_command: execvp /usr/local/mail-captcha/tmp.pl: Permission denied Jan 19 00:57:45 ip-99-99-99-99 postfix/pipe[10681]: B559C2026D: to=<xxxxxx@xxxxxxxx.net>, relay=mailcaptcha, delay=2727, delays=2726/0.5/0/0.57, dsn=4.3.0, status=deferred (temporary failure. Command output: pipe: fatal: pipe_command: execvp /usr/local/mail-captcha/tmp.pl: Permission denied ) 
master.cf
mailcaptcha unix - n n - - pipe  flags=FR user=vmail argv=/usr/bin/perl /usr/local/mail-captcha/tmp.pl $ $ 

# ls -Z tmp.pl -rwxr-xr-x. vmail vmail unconfined_u:object_r:usr_t:s0 tmp.pl  # postqueue -p -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- B559C2026D 625 Thu Jan 19 00:12:18 xxxx@xxxxx.com (temporary failure. Command output: pipe: fatal: pipe_command: execvp /usr/local/mail-captcha/tmp.pl: Permission denied) xxxxx@xxxxxx.com  # chcon -t postfix_pipe_t tmp.pl chcon: failed to change context of `tmp.pl' to `unconfined_u:object_r:postfix_pipe_t:s0': Permission denied  # semanage fcontext -a -t mailcaptcha_t '/usr/local/mail-captcha(/.*)?' /usr/sbin/semanage: Type mailcaptcha_t is invalid, must be a file or device type 

Кажется, все будет работать, если бы не SELinux. Как мне создать новый контекст безопасности для этого файла и проекта? Я видел это ( http://fedoraproject.org/wiki/PackagingDrafts/SELinux#Creating_new_types ), но я не понимаю каждую строку, и кажется, что она делает гораздо больше, чем просто создает простой контекст.

CentOS релиз 6.8 (финал)

2

0 ответов на вопрос

Похожие вопросы