RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1097775 - ftp_home_dir set to off allows FTP login to user home directory
Summary: ftp_home_dir set to off allows FTP login to user home directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.0
Hardware: All
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Dalibor Pospíšil
Mirek Jahoda
URL:
Whiteboard:
Depends On: 1066124
Blocks: 1205796 1389256
TreeView+ depends on / blocked
 
Reported: 2014-05-14 13:48 UTC by Dalibor Pospíšil
Modified: 2019-09-12 07:53 UTC (History)
9 users (show)

Fixed In Version: selinux-policy-3.13.1-100.el7
Doc Type: Bug Fix
Doc Text:
The `ftp_home_dir` SELinux boolean was removed Previously, the user was able to login to the home directory despite the `ftp_home_dir` SELinux boolean set to `off`. With this update, the `ftp_home_dir` boolean was removed.
Clone Of: 1066124
: 1389256 (view as bug list)
Environment:
Last Closed: 2016-11-04 02:17:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2283 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2016-11-03 13:36:25 UTC

Description Dalibor Pospíšil 2014-05-14 13:48:15 UTC
+++ This bug was initially created as a clone of Bug #1066124 +++

Description of problem:

Setting selinux boolean ftp_home_dir to off allows login for users to their home directory with proftpd server.



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

# rpm -qa | grep selinux
libselinux-2.2.2-6.el7.x86_64
libselinux-utils-2.2.2-6.el7.x86_64
selinux-policy-targeted-3.12.1-153.el7.noarch
selinux-policy-3.12.1-153.el7.noarch
libselinux-python-2.2.2-6.el7.x86_64

# rpm -q vsftpd
vsftpd-3.0.2-9.el7.x86_64



How reproducible:

# getsebool -a | grep ftp
ftp_home_dir --> off
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> off
tftp_home_dir --> off

# lftp -d -e 'set net:max-retries 1; set ftp:passive-mode on;ls;quit' -u ftptest,redhat 127.0.0.1
---- Connecting to 127.0.0.1 (127.0.0.1) port 21
<--- 220 (vsFTPd 3.0.2)
---> FEAT
<--- 211-Features:
<---  EPRT
<---  EPSV
<---  MDTM
<---  PASV
<---  REST STREAM
<---  SIZE
<---  TVFS
<---  UTF8
<--- 211 End
---> OPTS UTF8 ON
<--- 200 Always in UTF8 mode.
---> USER ftptest
<--- 331 Please specify the password.
---> PASS redhat
<--- 230 Login successful.
---> PWD
<--- 257 "/home/ftptest"
---> PASV
<--- 227 Entering Passive Mode (127,0,0,1,71,115).
---- Connecting data socket to (127.0.0.1) port 18291
---- Data connection established
---> LIST
<--- 150 Here comes the directory listing.
---- Got EOF on data connection
---- Closing data socket
-rw-r--r--    1 0        0               0 May 07 09:16 testfile
<--- 226 Directory send OK.
---> QUIT
---- Closing control socket

Steps to Reproduce:
1. set ftp_home_dir to off, if it isn't off.
2. try to connect to home dir as user

Actual results:
User login to ftp server is possible.

Expected results:
No user login to ftp server possible.

Comment 12 Simon Sekidde 2015-07-21 13:47:46 UTC
Patch sent to Lukas

Comment 15 Lukas Vrabec 2016-04-26 11:35:21 UTC
Problem here is this rule: 
[root@rhel7-virt ~]# sesearch -A -s ftpd_t -t user_home_t -C  -c dir | grep -v DT
Found 8 semantic av rules:
   allow userdom_filetrans_type user_home_t : dir { ioctl read write getattr lock add_name remove_name search open } ; 

This rule is part of following macro: 
userdom_filetrans_home_content(ftpd_t)

Unfortunately, userdom_filetrans_home_content() cannot be part of any boolean block and filename transition rule cannot be part of any conditional block. This is caused by limiting m4 macro language. 

I incline to comment4, to remove this boolean.

Comment 17 Dalibor Pospíšil 2016-06-16 12:21:56 UTC
I'm not really sure if removing that boolean is proper solution. If we cannot fix it properly using m4 will we be able to do it using CIL?

Comment 18 Branislav Náter 2016-07-19 15:57:13 UTC
ftp access to home dir is disabled by default. To enable it "semanage boolean -m ftpd_full_access --on" instead of "setsebool ftp_home_dir on" have to be run. Please make sure that this is documented.

Comment 19 Jan Kepler 2016-07-22 12:45:28 UTC
----
time->Wed Jul 20 15:41:02 2016
type=SYSCALL msg=audit(1469022062.310:232): arch=c000003e syscall=2 success=no exit=-13 a0=7f68b980f720 a1=800 a2=7f68b9805ff0 a3=578f7f6e items=0 ppid=5648 pid=5653 auid=4294967295 uid=1001 gid=1001 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=(none) ses=4294967295 comm="vsftpd" exe="/usr/sbin/vsftpd" subj=system_u:system_r:ftpd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1469022062.310:232): avc:  denied  { read } for  pid=5653 comm="vsftpd" name="file.txt" dev="dm-2" ino=81 scontext=system_u:system_r:ftpd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:user_home_t:s0 tclass=file
----

I have the same issue with tests for basics ftp scenarios in wget test suite.

Not sure if enabling ftpd_full_access is not too "strong" way how to handle it.

selinux-policy-3.13.1-89.el7

Comment 20 Dalibor Pospíšil 2016-07-26 11:02:03 UTC
I'm also getting similar AVC regarding this issue in vsftpd smoke test.

time->Thu Jul 21 04:36:18 2016
type=PROCTITLE msg=audit(1469090178.835:975): proctitle=2F7573722F7362696E2F767366747064002F6574632F7673667470642F7673667470642E636F6E66
type=SYSCALL msg=audit(1469090178.835:975): arch=c00000b7 syscall=56 success=no exit=-13 a0=ffffffffffffff9c a1=2aaf163c420 a2=841 a3=1b6 items=0 ppid=15028 pid=15033 auid=4294967295 uid=1001 gid=1001 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=(none) ses=4294967295 comm="vsftpd" exe="/usr/sbin/vsftpd" subj=system_u:system_r:ftpd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1469090178.835:975): avc:  denied  { create } for  pid=15033 comm="vsftpd" name="testfile.txt" scontext=system_u:system_r:ftpd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0

Comment 31 Mirek Jahoda 2016-09-29 13:05:55 UTC
Hello,

we should describe this bug fix in 7.3 Release Notes - could you please provide CCFR (Doc Text)? (I will also update Security Guide.)

Comment 33 errata-xmlrpc 2016-11-04 02:17:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2283.html


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