byrdman wrote:speaking of vsftpd, I was wanting to know the most secure way to run it. I hear that SANS, which I have become a big fan of, really likes it. Since my web/ftp server just crashed because of hw issues, I get to rebuild it with FC1/2. (not sure which one yet)
anywho, does anyone have a really good config to really secure up the vsftpd?
I want one login, say ftpadmin to be able to have write access to all the 'child' logins that I create. I work for a company where the 'admin' login controls the 'child' logins. But at the same time the 'admin' login is chrooted...!?
Ok, I worked out an example config that does what you want. In my example I have added 4 more users to my system. "ftpadmin" is the user that needs access to all the other ftp users and with read/write access to their stuff. Then I created users "ftp1", "ftp2", and "ftp3".
I used the plain old adduser command:
- Code: Select all
# adduser ftpadmin
# adduser ftp1
# adduser ftp2
# adduser ftp3
Then I changed the /etc/passwd file so that all users had the same primary group as the "ftpadmin" user (in this example the "ftpadmin" group ID happened to be 10025) and set their login shell to "/sbin/nologin" so they wouldn't be able to get a shell login. I also made the regular ftp users' home directories as subdirectories of the ftpadmin user. Here's the relevant part of the passwd file:
- Code: Select all
ftpadmin:x:10025:10025:FTP Admin:/home/ftpadmin:/bin/false
ftp1:x:10026:10025:FTP User 1:/home/ftpadmin/ftp1:/sbin/nologin
ftp2:x:10027:10025:FTP User 2:/home/ftpadmin/ftp2:/sbin/nologin
ftp3:x:10028:10025:FTP User 3:/home/ftpadmin/ftp3:/sbin/nologin
Then I set up the directory structure as needed:
- Code: Select all
# cd /home
# rm -rf ftp1 ftp2 ftp3 ftpadmin
# mkdir ftpadmin
# mkdir ftpadmin/ftp1
# mkdir ftpadmin/ftp2
# mkdir ftpadmin/ftp3
# chown -R ftpadmin:ftpadmin ftpadmin
# chmod -R 770 ftpadmin
Then I created a chroot list as /etc/vsftpd.chroot_list:
- Code: Select all
ftpadmin
ftp1
ftp2
ftp3
And set up my /etc/vsftpd.conf file like this:
http://voidmain.is-a-geek.net/files/vsftpd/vsftpd.confHere it is with the comments removed:
- Code: Select all
write_enable=YES
local_umask=002
anon_upload_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ftpd_banner=Welcome to Void Main's FTP server.
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
pam_service_name=vsftpd
userlist_enable=YES
listen=YES
tcp_wrappers=YES
When the normal ftp users log in they are chrooted to their directory and that is all they see. When the ftpadmin user logs in they are chrooted to their directory, however the other users directories are subdirectories of the ftpadmin ID so ftpadmin has access to them all. Since the umask is 002 any new files created will be rwx for the group and all files will be created group owned by ftpadmin. Users that are not in the vsftpd.chroot_list file will not be chrooted and have a normal full ftp login access.
Here are all the files:
http://voidmain.is-a-geek.net/files/vsftpd/