Overview
This document provides an example of how to configure ProFTPd to utilize the Host Access Control feature from the command line to restrict access by IP address to FTP. The information in this document applies to systems that run cPanel & WHM in CentOS 7, CloudLinux
ProFTPD does not automatically reference the /etc/hosts.allow
or /etc/hosts.deny
files to restrict access to the FTP service.
This document describes an unsupported workaround that we do not guarantee will work in the future.
- After you perform these steps on a server, the system administrator must manage and maintain the server’s database software.
- We recommend that only experienced system administrators attempt to perform these steps.
- We are not responsible for any data loss that an attempt to perform these steps causes.
CentOS 8, AlmaLinux 8, and CloudLinux 8 systems
CentOS 8 removed support for the TCP Wrappers package (tcp_wrappers
). This change means that ProFTPD does not use TCP-Wrappers-based access controls on CentOS 8, AlmaLinux 8, and CloudLinux 8 systems. The rest of ProFTPD’s functionality still works in those operating systems. ProFTPD’s functionality in cPanel & WHM version 92 on CentOS 6 and 7, CloudLinux 6 and 7, and Red Hat Enterprise Linux 7 systems continues to use TCP-Wrappers-based access controls.
The unsupported workaround described in this document is not supported in CentOS 8 or AlmaLinux 8. Instead, use the functionality available in WHM’s Host Access Control interface.
cPanel & WHM version 92 for CentOS 8 and CloudLinux 8 is experimental software and we do not recommend using it in production environments. For more information, read our cPanel & WHM version 92 for CentOS 8 documentation.
Upgrade to a later version of cPanel & WHM to use CentOS 8 and CloudLinux 8 in production environments.
System Requirements:
To configure ProFTPD, the following software must run on your server:
- ProFTPD version 1.3.3 and later.
- The
mod_wrap
module.
As the root
user, run the following command to confirm that you have the correct version of ProFTPD and mod_wrap
installed on your server:
proftpd -V | awk '/Version/ {print $0}; /mod_wrap/ {print "mod_wrap is installed"}'
The output will resemble the following example:
|
|
Create a VirtualHost container
To configure ProFTPD, create a Virtual Host container. To do this, perform the following steps as the root
user:
-
Open the
/etc/proftpd.conf
file with a text editor and add the following lines after the comments:1 2
TCPAccessFiles /etc/hosts.allow /etc/hosts.deny TCPServiceName ftp
Warning:- Each Virtual Host that requires Host Access Control needs this entry in the
/etc/proftpd.conf
file. - You must specify both
/etc/hosts.allow
and/etc/hosts.deny
or you will receive an error.
- Each Virtual Host that requires Host Access Control needs this entry in the
-
Run the
/usr/local/cpanel/scripts/restartsrv_proftpd
script to restart ProFTPD. -
Add access deny rules to the
/etc/ftpusers
file. This file lists of all of the users for whom to deny FTP access. -
Log in to your FTP server to test the new configuration.
Note:If ProFTPD rejects connections due to Host Access Control configuration, the system will report those failures as authentication failures. For example:
1 2 3 4 5 6 7 8 9 10 11
root@testserver [~]# ftp 10.1.1.1 Connected to 10.1.1.1. 220 ProFTPD 1.3.5rc1 Server (ProFTPD) [::ffff:10.1.1.1] Name (10.1.1.1:root): cptest 331 Password required for cptest Password: 530 Access denied ftp: Login failed ftp> quit 221 Goodbye.
VirtualHost container example
The following example resembles a complete VirtualHost container.
|
|