This page will detail the installation of FTPS using vsftpd. The following list are some of the specific changes that have been made.
You must follow the below installation steps prior to installing the Application.
yum install vsftpd rsync mailxsystemctl enable vsftpdsemanage boolean -m --on ftp_home_dirsemanage boolean -m --on ftpd_anon_writemkdir -p /apps/ftpssemanage fcontext -a -f d -t public_content_t "/apps/ftps"semanage fcontext -a -t public_content_rw_t "/apps/ftps(/.*)?"restorecon -rv /apps/ftps/chmod -R 555 /apps/ftps/chown -R root:webupdates /apps/ftps/cd /etc/vsftpd/openssl genrsa -out ftps_2015.key 2048openssl req -new -key ftps_2015.key -out ftps_2015.csrcd /etc/vsftpd/vim ftps_2015.crtchmod 400 ftps_2015.*vim /etc/vsftpd/vsftpd.conf# Disallow anonymous FTPanonymous_enable=NO# Uncomment this to allow local users to log in.local_enable=YES# Uncomment this to enable any form of FTP write command.write_enable=YES# Set the umask for when files are createdfile_open_mode=0666local_umask=0007# Set new listening and data portconnect_from_port_20=NOftp_data_port=38590listen_port=38591# Set the passive port for a data connectionpasv_enable=YESpasv_min_port=38592pasv_max_port=38599pasv_addr_resolve=yespasv_address=vsftpd.example.co.uk# Set the login bannerbanner_file=/etc/issue# chroot local userschroot_local_user=YESsecure_chroot_dir=/usr/share/empty# Make the server listen on a specific IP.listen=YESlisten_address=10.105.218.18# Disable listen on ipv6listen_ipv6=NO# Enable SSL and only allow TLS v1ssl_enable=YESssl_tlsv1=YESssl_sslv2=NOssl_sslv3=NOrsa_cert_file=/etc/vsftpd/ftps_2015.crtrsa_private_key_file=/etc/vsftpd/ftps_2015.keyrequire_ssl_reuse=YES# Force non-anonymous logins to use SSL for data and password encryptionforce_local_data_ssl=YESforce_local_logins_ssl=YES# Disallow Anonymous Accessallow_anon_ssl=NOanonymous_enable=NOipa hbacrule-add vsftp_access --desc="Access to ftps Server"ipa hbacrule-add-host vsftp_access --hosts=vsftpdhostipa hbacrule-add-user vsftp_access --groups=rwcipa hbacrule-add-service vsftp_access --hbacsvcs=vsftpdUsers and groups are added to IdM and then to the relevant group. Documentation for this is at IdM User/Group Management. Specifically, users should not have a login shell. Example below. Each upload folder should have it's own group with the required users. EVERY group must have the rsync user added for rsync to work.
ipa user-add "ftps.user" --first="Ftps" --last="User" --email="user_email@example.com" --city=london --shell="/sbin/nologin" --random
ipa group-add rwc --desc="RWC ftps update group"ipa group-add-member rwc --users="ftps.user"You must also add any new groups to the hbac rule allowing access to the vsftpd server.
ipa hbacrule-add-user --groups=rwc vsftp_access
Ensure that the group has been added into IdM before creating the folder structure. Create the new site folder structure. Example only
mkdir -p /apps/ftps/cricketchmod -R 2770 /apps/ftps/cricket
chown -R root:cricket /apps/ftps/cricketA slightly more interesting setup is when you need a group of users to be able to upload to a sub folder of the site. For example group. The group can upload to all folders. group2 need to be able to upload to the sub folder group/folder/
mkdir -p /apps/ftps/group/folderchmod -R 2770 /apps/ftps/group
chown -R root:group2 /apps/ftps/groupsetfacl -m g:group:rx /apps/ftps/group/setfacl -m g:group:rwx /apps/ftps/group/folder/
A user called rsync has been setup in IdM with ssh keys along with the relevant HBAC rules to allow for the synchronisation of the files. Add the following to the root crontab. Note that some web sites may need a custom rsync like rwc which requires that some folders are excluded. The Developer will advise how often a rsync will need to run. Every 10 minutes should be fine.
# Default00,10,20,30,40,50 * * * * rsync -rptz --delete --chmod=Dug=rx,o=,Fug=r,o= /apps/ftps/cricket/ rsync@webserver:/apps/http/www/cricket/
# RWC #00,10,20,30,40,50 * * * * rsync -rtvz --exclude=/uploads --exclude=chat --delete --chmod=Dug+rx,Fug+r,Dug-w,Fug-w /apps/ftps/group/folder/ root@webserver.example.co.uk:/apps/http/www/rwc/