Fedora comes withs SELinux and by default the settings are quite retrictive, an unfortunate necessity in today's hostile environment. This is particular true when SSL family (ssh, scp, etc.) has gradually replaced its plain-text counterpart (telnet, ftp, rsh, rcp, etc.). The setting for these insecure protocols is very protective.
However, in an intranet environment, when efficiency is more prioritized than security, these old tools still serve well. For example, I frequently have to transport huge files from a machine to another but don't want to use scp for it's very CPU and network bandwidth hungry. I would usually setup a temporary ftp server to do the file transport and turn it off afterwards. This is much faster than adding directory and authentication setting to samba or NFS.
Here I summarize how one can quickly setup vsftpd to accept download and upload.
I choose vsftpd due to its efficiency. I think Fedora made a good choice in making it the default ftp server. Since vsftpd comes in the server package by default, I won't go over the procedure of installing it. Note that these is tested on FC4 only. FC5+ may have different policies.
- su -
- Edit /etc/vsftpd/vsftpd.conf, make sure we have the following lines:
- anonymous_enable=NO
- write_enable=YES
- anon_upload_enable=YES
- anon_mkdir_write_enable=YES
- nopriv_user=ftp (the default is ftpsecure, but since Fedora has ftp account in /etc/passwd already, I simply use ftp instead)
- Give the account ftp a password by "passwd ftp"
- Change the security context for our anonymous ftp home directory (/var/ftp)
- chcon -R system_u:object_r:ftpd_anon_t /var/ftp (you can verify this by ls -Z)
- Make one directory for upload, and change its security context.
- mkdir /var/ftp/upload
- chcon -t ftpd_anon_rw_t /var/ftp/upload
- Turn on the SELinux boolean for ftpd_anon_rw_t
- setsebool -P allow_ftpd_anon_write 1
- add "allow_ftpd_anon_write=1" to /etc/selinux/targeted/booleans.local
- That's it.
Reference: Daniel J Walsh's reply to a discussion on this topic.
No comments:
Post a Comment