Bug 632460
Summary: | SELinux is preventing /bin/mailx "read" access on /var/log/vsftpd.log-20100810. | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Alfred Reaud <alreaud> |
Component: | selinux-policy | Assignee: | Miroslav Grepl <mgrepl> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 12 | CC: | dwalsh, jkaluza, mgrepl, tsmetana |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | setroubleshoot_trace_hash:e5f254c80abf6a3278a40d09a9935a706eefc243f90aa11c6bf8671c81b89d87 | ||
Fixed In Version: | selinux-policy-3.7.19-62.fc13 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2010-10-05 09:35:26 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Alfred Reaud
2010-09-10 02:14:12 UTC
Reported to user operating as a limited user (non-root). The cause of the error is unknown, as the user was not accessing the email system at this time. However, log rotation will email the rotated log to the root user. But that should occur at approximately 4AM local time. This is a new error that started occurring after the upgrade to kernel .166. Do you use standard /etc/logrotate.d/vsftpd file? # cat /etc/logrotate.d/vsftpd /var/log/vsftpd.log { # ftpd doesn't handle SIGHUP properly nocompress missingok } Are you trying to mail the xferlog_t ? Are you using epylog? @Miroslav: I'm using the following logrotate configuration for vsftpd # cat /etc/logrotate.d/vsftpd /var/log/vsftpd.log { # ftpd doesn't handle SIGHUP properly nocompress missingok mail root } @Daniel: epylog isn't installed. vstpd.log is selinux type xferlog_t, and so are the archive logs such as vstpd.log-20100905. This looks like a leaked file descriptor from logrotate. Does logrotate open this file for read? If so, make sure you close the file descriptor on exec. fcntl(fd, F_SETFD, FD_CLOEXEC) Will do this. Yes, logrotate opens that file and it looks it leaks file descriptors on exec. I will try to fix this issue, although, I'm not able to reproduce it here so far. After some debugging I've found out logrotate doesn't set FD_CLOEXEC, but it closes descriptors "manually" before exec, so it should not leaks descriptors (I've also tested in in valgrind). I've discussed it with Miroslav and I think the problem is that logrotate executes "mail" command (because of "mail root" directive in /etc/logrotate.d/vsftpd config file) and uses log file descriptor as stdin. "mail" runs in system_mail_t domain, but vsftpd.log uses xferlog_t domain, so SELinux denies mail to read that file. I'm not SELinux expert, so please correct me if I'm completely wrong. So by adding the mail directive to a logrotate command means mail the log file to someone. Miroslav we need to do the same thing we did for logwatch. Create a logrotate_mail_t. #mta_send_mail(logrotate_t) mta_base_mail_template(logrotate) mta_sendmail_domtrans(logrotate_t, logrotate_mail_t) role system_r types logrotate_mail_t; logging_read_all_logs(logrotate_mail_t) manage_files_pattern(logrotate_mail_t, logrotate_tmp_t, logrotate_tmp_t) Fixed in selinux-policy-3.7.19-60.fc13 selinux-policy-3.7.19-62.fc13 has been submitted as an update for Fedora 13. https://admin.fedoraproject.org/updates/selinux-policy-3.7.19-62.fc13 selinux-policy-3.7.19-62.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update selinux-policy'. You can provide feedback for this update here: https://admin.fedoraproject.org/updates/selinux-policy-3.7.19-62.fc13 selinux-policy-3.7.19-62.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report. |