LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-04-2010, 02:56 PM   #1
grob115
Member
 
Registered: Oct 2005
Posts: 542

Rep: Reputation: 32
vsftpd vs SELinux


Hi, I've configured my vsftpd to use chroot for a ftp account. So whenever a ftp user logs in, they'll be chroot to /ftpuser. However, it appears that SELinux is having an issue with this and I have to issue the following command in order to do uploads...
Code:
setsebool -P allow_ftpd_full_access=1
Somehow this doesn't appear to be the right approach. Has anyone else encountered similar issue?

Following is the SELinux message...
Code:
[root@uat ~]# sealert -l 83137bfa-1735-4107-bdb7-f7cd762174de

Summary:

SELinux is preventing the ftp daemon from writing files outside the home
directory (./ftpuser).

Detailed Description:

SELinux has denied the ftp daemon write access to directories outside the home
directory (./ftpuser). Someone has logged in via your ftp daemon and is trying to
create or write a file. If you only setup ftp to allow anonymous ftp, this could
signal a intrusion attempt.

Allowing Access:

If you do not want SELinux preventing ftp from writing files anywhere on the
system you need to turn on the allow_ftpd_full_access boolean: "setsebool -P
allow_ftpd_full_access=1"

The following command will allow this access:

setsebool -P allow_ftpd_full_access=1

Additional Information:

Source Context                root:system_r:ftpd_t
Target Context                root:object_r:usr_t
Target Objects                ./ftpuser [ dir ]
Source                        vsftpd
Source Path                   /usr/sbin/vsftpd
Port                          <Unknown>
Host                          test.mysite.com
Source RPM Packages           vsftpd-2.0.5-16.el5_5.1
Target RPM Packages
Policy RPM                    selinux-policy-2.4.6-279.el5
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   allow_ftpd_full_access
Host Name                     test.mysite.com
Platform                      Linux test.mysite.com 2.6.18-194.el5 #1 SMP Fri
                              Apr 2 14:58:14 EDT 2010 x86_64 x86_64
Alert Count                   2
First Seen                    Mon Oct  4 12:31:27 2010
Last Seen                     Mon Oct  4 12:34:28 2010
Local ID                      83137bfa-1735-4107-bdb7-f7cd762174de
Line Numbers

Raw Audit Messages

host=test.mysite.com type=AVC msg=audit(1286220868.906:8856): avc:  denied  { write } for  pid=19649 comm="vsftpd" name="ftpuser" dev=dm-0 ino=850386 scontext=root:system_r:ftpd_t:s0 tcontext=root:object_r:usr_t:s0 tclass=dir

host=test.mysite.com type=SYSCALL msg=audit(1286220868.906:8856): arch=c000003e syscall=83 success=no exit=-13 a0=2b21eefe1330 a1=1ff a2=1 a3=0 items=0 ppid=19645 pid=19649 auid=0 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=(none) ses=841 comm="vsftpd" exe="/usr/sbin/vsftpd" subj=root:system_r:ftpd_t:s0 key=(null)
 
Old 10-04-2010, 04:25 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by grob115 View Post
Code:
host=test.mysite.com type=AVC msg=audit(1286220868.906:8856): avc:  denied  { write } for  pid=19649 comm="vsftpd" name="ftpuser" dev=dm-0 ino=850386 scontext=root:system_r:ftpd_t:s0 tcontext=root:object_r:usr_t:s0 tclass=dir

host=test.mysite.com type=SYSCALL msg=audit(1286220868.906:8856): arch=c000003e syscall=83 success=no exit=-13 a0=2b21eefe1330 a1=1ff a2=1 a3=0 items=0 ppid=19645 pid=19649 auid=0 uid=501 gid=501 euid=501 suid=501 fsuid=501 egid=501 sgid=501 fsgid=501 tty=(none) ses=841 comm="vsftpd" exe="/usr/sbin/vsftpd" subj=root:system_r:ftpd_t:s0 key=(null)
Running the AVC through 'audit2allow' I get
Code:
#============= ftpd_t ==============
allow ftpd_t usr_t:dir write;
Now that "usr_t" context doesn't sound right to me (shouldn't that be "user_home_dir_t" when it's a unprivileged users home?) but then again 'sesearch -s ftpd_t -t usr_t -a | grep dir.*write' returns
Code:
   allow ftpd_t usr_t : dir { ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir };
so...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selinux-how do i find out what domains have permissions on what type?(selinux policy) vishyc88 Linux - Security 2 11-22-2010 04:27 AM
SElinux stricts vsftpd Rodnower Linux - Security 2 08-24-2010 04:41 PM
vsftpd and SELinux HelplessNewbie Linux - Software 6 08-28-2007 10:54 AM
Anyone actually have anonymous vsftpd working while protected with selinux? ironmike Fedora 5 08-23-2006 09:20 AM
selinux with vsftpd and httpd swpr Linux - Security 4 06-28-2006 05:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration